1008 lines
42 KiB
TypeScript
1008 lines
42 KiB
TypeScript
// Metro module 12572 (f12573).
|
|
import { forwardRef, useEffect, useCallback, useLayoutEffect } from "react";
|
|
import { Image, View, ScrollView } from "react-native";
|
|
import { useNativeCheckoutStore } from "../../checkout/native/NativeCheckoutStore";
|
|
import GuildStore from "../../../stores/GuildStore";
|
|
import SubscriptionPlanStore from "../../../stores/billing/SubscriptionPlanStore";
|
|
import SubscriptionStore from "../../../stores/billing/SubscriptionStore";
|
|
import IAPStore_android from "../../../stores/native/IAPStore.android";
|
|
import { usePremiumPlanSelectStore, setIsPurchasing } from "./PremiumPlanSelectStore";
|
|
import { GUILD_BOOST_COST_FOR_PREMIUM_USER_DISCOUNT_PERCENT, NUM_FREE_GUILD_BOOSTS_WITH_PREMIUM, PremiumTypes, SubscriptionIntervalTypes, PRICE_PLACEHOLDER, SubscriptionPlans, PremiumSubscriptionSKUs } from "../PremiumConstants";
|
|
import * as _Constants from "../../../Constants";
|
|
import { PaymentGateways, HorizontalGradient, SubscriptionStatusTypes, AnalyticsObjects, AnalyticsObjectTypes, AnalyticEvents } from "../../../Constants";
|
|
import { getPremiumGradientColor, Gradients } from "../../colors/native/ColorConstants";
|
|
import { ItemPurchaseType } from "../../payments/PaymentConstants";
|
|
import { jsx } from "react/jsx-runtime";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import TextStyles from "../../rebrand/native/TextStyles";
|
|
import { DARK_WHITE_500_LIGHT_BLACK_500, DARK_PRIMARY_630_LIGHT_PRIMARY_230 } from "../../../design/migrations/native/LegacyTokens";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { Stack } from "../../../design/components/Stack/native/Stack.native";
|
|
import { TreasureChestBannerSpotIllustration } from "../../../design/assets/native";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import PremiumUtils, { getPremiumTypeDisplayName, getPremiumTypeFromSubscription, castPremiumSubscriptionAsSkuId } from "../../../utils/PremiumUtils";
|
|
import Module12574 from "../../../_bundle/Module12574";
|
|
import Module12575 from "../../../_bundle/Module12575";
|
|
import Module12576 from "../../../_bundle/Module12576";
|
|
import Module12577 from "../../../_bundle/Module12577";
|
|
import Module12578 from "../../../_bundle/Module12578";
|
|
import Module12579 from "../../../_bundle/Module12579";
|
|
import { NitroWheelIcon } from "../../../design/components/Icon/native/redesign/generated/NitroWheelIcon";
|
|
import { useToken } from "../../../design/tokens/native/useToken";
|
|
import { useStateFromStoresArray, useStateFromStores } from "../../../_bundle/Module589";
|
|
import { usePremiumTier2DeltaPriceString } from "./hooks/usePremiumTier2DeltaPriceString";
|
|
import { useCheckoutPlanPriceString } from "./hooks/useCheckoutPlanPriceString";
|
|
import useTheme from "../../../hooks/useTheme";
|
|
import { LegacyText } from "../../../design/void/native";
|
|
import openPremiumPlanWhatYouLoseActionSheet from "./openPremiumPlanWhatYouLoseActionSheet";
|
|
import { WhatYouLoseMode } from "./PremiumPlanWhatYouLoseActionSheet";
|
|
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
|
|
import BoostGemPixel from "../powerups/native/images/BoostGemPixel";
|
|
import { ActivityIndicator } from "../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
|
|
import { TouchableHighlight } from "../../../_bundle/Module5273";
|
|
import { isThemeDark } from "../../../design/shared";
|
|
import * as _Module501 from "../../../_bundle/Module501";
|
|
import { getToggledIntervalProduct, getSubscriptionItemsForProduct, getProductIdFromSubscription, getPremiumBundledItemsFromProductId, getProductIdsForBothIntervals, productsHaveSamePerks, getModifySubscriptionItemsForProduct, isValidBundleProductId, getPremiumBundlesWithPredicate } from "./PremiumBundledPlansUtils";
|
|
import { PaymentFlowStep, getNewAnalyticsLoadId, getBasePurchaseFlowAnalyticsFields, getPaymentFlowStepAnalyticsFields } from "./PremiumAnalyticsUtils";
|
|
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
|
|
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
|
|
import Module4611 from "../../../_bundle/Module4611";
|
|
import { getShouldRemoveYearlyUpsell, getMobileBoostingEnabled, getRecommendedBoostCount } from "../powerups/experiments/MobileBoostingExperiment";
|
|
import { AppStorePremiumProductIdsToPremiumBundledItems } from "./ProductIds.android";
|
|
import { captureBillingException } from "../../../utils/BillingUtils";
|
|
import ModalActionCreators from "../../../actions/ModalActionCreators";
|
|
import { PREMIUM_KEY } from "../../../components_native/premium/PremiumModal";
|
|
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
|
|
import { fetchPremiumSubscriptionPlans } from "../../../actions/SubscriptionPlanActionCreators";
|
|
import useInitialValue from "../../../hooks/useInitialValue";
|
|
import useMountEffect from "../../../hooks/useMountEffect";
|
|
import { trackPaymentFlowStartedAnalyticsAndCTP } from "../../experiments/trigger_points/PaymentFlowStartedTriggerPoint";
|
|
import { useHandlePremiumPurchase } from "./handlePremiumPurchase.android";
|
|
import { useNavigation } from "../../../design/components/Navigator/native/useNavigation.native";
|
|
import { useIsPaymentsBlocked } from "../../billing/experiments/BlockedPaymentsCountryExperiment";
|
|
import { useFetchSubscriptionInvoicePreview } from "../PremiumSubscriptionInvoice";
|
|
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
|
|
import InvalidGooglePlayPurchase from "../../billing/errors/InvalidGooglePlayPurchase";
|
|
import { fetchSubscriptions } from "../../billing/actions/BillingActionCreators";
|
|
import BlockedPaymentsCountryDisplay from "../../billing/native/BlockedPaymentsCountryDisplay";
|
|
import { PremiumSubscriptionHeader } from "../../../components_native/premium/PremiumSubscriptionDetails";
|
|
import { getExternalManagementMessage } from "./utils/PremiumManagementUtils";
|
|
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
|
|
import { NitroACOMSubscriptionExperiment } from "../../billing/native/ACOMExperiments";
|
|
import NativeCheckoutStoreProvider from "../../checkout/native/stores/NativeCheckoutStoreProvider";
|
|
function $mk118358($env) {
|
|
return ({ paymentGateway }) => {
|
|
AlertActionCreators.close();
|
|
if (paymentGateway === PaymentGateways.APPLE_ADVANCED_COMMERCE) {
|
|
let env32034 = {
|
|
$parent: $env
|
|
};
|
|
const premiumTypeSubscription = SubscriptionStore.getPremiumTypeSubscription();
|
|
env32034[0] = premiumTypeSubscription;
|
|
if (premiumTypeSubscription == null) {
|
|
const r29 = $env.$parent;
|
|
captureBillingException(new Error("PremiumActivatedAlert: no premium subscription in store post-activation"), {
|
|
tags: {
|
|
source: "showPremiumActivatedAlert.nullSubscription"
|
|
}
|
|
});
|
|
ModalActionCreators.popWithKey(PREMIUM_KEY);
|
|
const r46 = r29[5];
|
|
if (r46.canGoBack()) {
|
|
r46.goBack();
|
|
}
|
|
} else {
|
|
AlertActionCreators.openLazy({
|
|
importer: () => {
|
|
const r1 = env32034.$parent.$parent.$parent;
|
|
const r3 = r1[0];
|
|
const r4 = r1[2];
|
|
return r3(r4[49])(r4[57], r4.paths).then(({ default: default4 }) => (a0) => {
|
|
return env32034.$parent.$parent.$parent[32](default4, {
|
|
...a0,
|
|
subscription: env32034[0],
|
|
onClose: () => {
|
|
a0.onClose();
|
|
const r4 = env32034.$parent.$parent.$parent;
|
|
const r3 = r4[1];
|
|
const r7 = r4[2];
|
|
r3(r7[55]).popWithKey((0, r4[0])(r7[56]).PREMIUM_KEY);
|
|
const r19 = env32034.$parent.$parent[5];
|
|
if (r19.canGoBack()) {
|
|
r19.goBack();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
}
|
|
let getPlanDescription, BoostDeltaPriceTrailing, PlanRow, PlanSection, CurrentPlanRow, PlanSectionHeader, PlanSections, useStyles, c8676_38, c8676_43, PremiumPlanSelect;
|
|
let env8676 = {};
|
|
const BoostPurchaseNitroBanner = function BoostPurchaseNitroBanner() {
|
|
const styles = useStyles();
|
|
return <Stack align="center" spacing={Module712.space.PX_12} style={styles.nitroBanner}>
|
|
<TreasureChestBannerSpotIllustration width={117} height={93} accessible={false} />
|
|
<Stack align="center" spacing={Module712.space.PX_4}>
|
|
<Text variant="text-md/semibold" color="text-default" style={styles.nitroBannerText}>
|
|
{intl.format(t.jbrHpT, {
|
|
discount: <Text key="discount" variant="text-md/semibold" color="text-feedback-positive">
|
|
{intl.format(t.RmVM19, {
|
|
percentageOff: GUILD_BOOST_COST_FOR_PREMIUM_USER_DISCOUNT_PERCENT
|
|
})}
|
|
</Text>
|
|
})}
|
|
</Text>
|
|
<Text variant="text-sm/medium" color="text-muted" style={styles.nitroBannerText}>
|
|
{intl.format(t.HYpETY, {
|
|
boostCount: NUM_FREE_GUILD_BOOSTS_WITH_PREMIUM
|
|
})}
|
|
</Text>
|
|
</Stack>
|
|
</Stack>;
|
|
};
|
|
getPlanDescription = function getPlanDescription(a0, r3 = false) {
|
|
return a0.premiumTier == null ? intl.formatToPlainString(t.gDsyB9, {
|
|
numSubscriptions: a0.numPremiumGuild
|
|
}) : a0.numPremiumGuild === 0 ? getPremiumTypeDisplayName(a0.premiumTier) : r3 ? intl.formatToPlainString(t.gDsyB9, {
|
|
numSubscriptions: a0.numPremiumGuild
|
|
}) : intl.formatToPlainString(a0.premiumTier === PremiumTypes.TIER_1 ? t.sexoHq : t.u6dBsN, {
|
|
num: a0.numPremiumGuild
|
|
});
|
|
};
|
|
BoostDeltaPriceTrailing = function BoostDeltaPriceTrailing(props) {
|
|
return <Stack direction="horizontal" align="center" spacing={Module712.space.PX_4}>
|
|
<NitroWheelIcon size="xs" color={Module712.colors.ICON_FEEDBACK_POSITIVE} />
|
|
<Text variant="text-sm/medium" color="text-muted">
|
|
{intl.format(props.interval === SubscriptionIntervalTypes.MONTH ? t.AbOLNu : t["rS8FA+"], {
|
|
price: <Text key="price" variant="text-sm/semibold" color="text-feedback-positive">{props.price}</Text>
|
|
})}
|
|
</Text>
|
|
</Stack>;
|
|
};
|
|
PlanRow = function PlanRow(props) {
|
|
let source;
|
|
let premiumTypeFromSubscription, c19899_4;
|
|
const { plan, purchase: purchase2, style, subscription } = props;
|
|
let disabled = props.disabled;
|
|
if (disabled === void 0) {
|
|
disabled = false;
|
|
}
|
|
const { hasBackground = false, shouldShowModernBoostFlow: shouldShowModernBoostFlow2 = false, showBoostOnlyLabels: showBoostOnlyLabels3 = false, recommendedBoostCount: recommendedBoostCount3 = null } = props;
|
|
premiumTypeFromSubscription = void 0;
|
|
c19899_4 = void 0;
|
|
const styles = useStyles();
|
|
const premiumPlanSelectStore2 = usePremiumPlanSelectStore((a0) => a0.isPurchasing);
|
|
const premiumPlanSelectStore = usePremiumPlanSelectStore((a0) => a0.purchasingProductId === plan.productId);
|
|
const token = useToken(Module712.colors.ACTIVITY_TIMEBAR_PROGRESS_BACKGROUND);
|
|
const [r25, r28] = useStateFromStoresArray([IAPStore_android], () => [IAPStore_android.getProduct(plan.productId), IAPStore_android.isBusy()]);
|
|
const r64 = (0, useNativeCheckoutStore)((a0) => a0.isPatchOrderLoading || a0.isCreateOrderLoading);
|
|
const premiumTier2DeltaPriceString = usePremiumTier2DeltaPriceString(plan, subscription, r25, shouldShowModernBoostFlow2);
|
|
const checkoutPlanPriceString = useCheckoutPlanPriceString(plan.productId, r25);
|
|
const theme = useTheme();
|
|
const r4 = plan.premiumTier === PremiumTypes.TIER_2 && plan.numPremiumGuild === 0;
|
|
const r31 = r4 ? (0, jsx)(LegacyText, {
|
|
style: [styles.rowText, styles.rowPlanDescriptionSubtext],
|
|
children: intl.format(t.he52LA, {
|
|
num: NUM_FREE_GUILD_BOOSTS_WITH_PREMIUM
|
|
})
|
|
}) : null;
|
|
const r3 = plan.premiumTier == null || plan.numPremiumGuild !== 0;
|
|
L29: {
|
|
if (plan.premiumTier == null) {
|
|
source = Module12574;
|
|
} else {
|
|
if (plan.numPremiumGuild === 0) {
|
|
const premiumTier = plan.premiumTier;
|
|
if (PremiumTypes.TIER_0 === premiumTier) {
|
|
source = Module12575;
|
|
break L29;
|
|
}
|
|
if (PremiumTypes.TIER_1 === premiumTier) {
|
|
source = Module12576;
|
|
break L29;
|
|
}
|
|
if (PremiumTypes.TIER_2 === premiumTier) {
|
|
source = Module12577;
|
|
break L29;
|
|
}
|
|
}
|
|
source = plan.premiumTier === PremiumTypes.TIER_1 ? Module12578 : Module12579;
|
|
}
|
|
}
|
|
const r122 = plan.interval === SubscriptionIntervalTypes.MONTH ? t.AbOLNu : t["rS8FA+"];
|
|
let price = premiumTier2DeltaPriceString;
|
|
if (price == null) {
|
|
price = checkoutPlanPriceString;
|
|
}
|
|
if (price == null) {
|
|
price = PRICE_PLACEHOLDER;
|
|
}
|
|
const r128 = intl.formatToPlainString(r122, {
|
|
price
|
|
});
|
|
let subLabel = r4 ? intl.formatToPlainString(t.RTaZb4, {
|
|
num: NUM_FREE_GUILD_BOOSTS_WITH_PREMIUM
|
|
}) : void 0;
|
|
premiumTypeFromSubscription = subscription != null ? getPremiumTypeFromSubscription(subscription) : null;
|
|
if (!disabled) {
|
|
disabled = premiumPlanSelectStore2;
|
|
}
|
|
if (!disabled) {
|
|
disabled = r28;
|
|
}
|
|
if (!disabled) {
|
|
disabled = r64;
|
|
}
|
|
const onPress = function onPress() {
|
|
L7: {
|
|
if (!c19899_4) {
|
|
L6: {
|
|
if (subscription != null) {
|
|
if (premiumTypeFromSubscription !== PremiumTypes.TIER_2 && premiumTypeFromSubscription !== PremiumTypes.TIER_1) {
|
|
break L6;
|
|
}
|
|
if (plan.premiumTier === PremiumTypes.TIER_0) {
|
|
openPremiumPlanWhatYouLoseActionSheet({
|
|
subscription,
|
|
mode: WhatYouLoseMode.DOWNGRADE,
|
|
onContinue: () => purchase2(plan.productId)
|
|
});
|
|
break L7;
|
|
}
|
|
}
|
|
}
|
|
purchase2(plan.productId);
|
|
}
|
|
}
|
|
};
|
|
c19899_4 = disabled;
|
|
if (shouldShowModernBoostFlow2) {
|
|
const r199 = recommendedBoostCount3 != null && plan.premiumTier === PremiumTypes.TIER_2 && plan.numPremiumGuild === recommendedBoostCount3;
|
|
const props2 = {
|
|
icon: r3 ? <BoostGemPixel width={32} height={32} /> : r4 ? <NitroWheelIcon size="xxs" color={Module712.colors.ICON_DEFAULT} /> : <Image style={styles.boostRowIcon} source={source} />,
|
|
label: getPlanDescription(plan, showBoostOnlyLabels3),
|
|
subLabel: null,
|
|
trailing: null,
|
|
arrow: true,
|
|
disabled: null,
|
|
onPress: null
|
|
};
|
|
if (r199) {
|
|
subLabel = <Text variant="text-xs/semibold" color="none" style={styles.recommendedText}>
|
|
{intl.string(t.WThgAR)}
|
|
</Text>;
|
|
}
|
|
props2.subLabel = subLabel;
|
|
props2.trailing = premiumPlanSelectStore ? <ActivityIndicator animating size="small" color={token} /> : premiumTier2DeltaPriceString != null ? <BoostDeltaPriceTrailing price={premiumTier2DeltaPriceString} interval={plan.interval} /> : <Text variant="text-sm/medium" color="text-muted" lineClamp={1}>{r128}</Text>;
|
|
if (disabled) {
|
|
disabled = !premiumPlanSelectStore;
|
|
}
|
|
props2.disabled = disabled;
|
|
props2.onPress = onPress;
|
|
return <TableRow {...props2} />;
|
|
}
|
|
return <TouchableHighlight activeOpacity={0.6} underlayColor={isThemeDark(theme) ? "none" : hasBackground ? Module712.unsafe_rawColors.PRIMARY_230 : "none"} accessibilityRole="button" disabled={disabled} onPress={onPress}>
|
|
<View style={[styles.row, style, (disabled ? !premiumPlanSelectStore : disabled) && styles.rowDisabled]}>
|
|
<Image style={styles[c8676_38[source]]} source={source} />
|
|
<LegacyText style={[styles.rowText, styles.rowPlanDescription]}>
|
|
{getPlanDescription(plan, showBoostOnlyLabels3)}
|
|
</LegacyText>
|
|
{r31}
|
|
<LegacyText style={[styles.rowText, styles.rowPrice]}>{r128}</LegacyText>
|
|
{premiumPlanSelectStore ? <ActivityIndicator animating size="small" style={styles.purchasingSpinner} color={token} /> : null}
|
|
</View>
|
|
</TouchableHighlight>;
|
|
};
|
|
PlanSection = function PlanSection(props) {
|
|
const { plans: plans2, label, shouldShowModernBoostFlow: shouldShowModernBoostFlow2 = false } = props;
|
|
let c19900_9, c19900_10;
|
|
const shouldShowModernBoostFlow = shouldShowModernBoostFlow2;
|
|
let showBoostOnlyLabels3 = props.showBoostOnlyLabels;
|
|
if (showBoostOnlyLabels3 === void 0) {
|
|
showBoostOnlyLabels3 = false;
|
|
}
|
|
const showBoostOnlyLabels = showBoostOnlyLabels3;
|
|
const { recommendedBoostCount, purchase: purchase3, analyticsLoadId, trackNewPaymentFlow: trackNewPaymentFlow2, trackPaymentFlowStep: trackPaymentFlowStep2, subscription: subscription2, shouldRemoveYearlyUpsell } = props;
|
|
c19900_9 = void 0;
|
|
c19900_10 = void 0;
|
|
const r10 = (0, useNativeCheckoutStore)((a0) => a0.getCheckoutContextRecord());
|
|
c19900_9 = r10;
|
|
c19900_10 = _Module501.isIOS() && r10 != null;
|
|
const r27 = plans2.map((item) => (0, jsx)(PlanRow, {
|
|
plan: item,
|
|
subscription: subscription2,
|
|
shouldShowModernBoostFlow,
|
|
showBoostOnlyLabels,
|
|
recommendedBoostCount,
|
|
purchase: (a0) => {
|
|
const productId = a0;
|
|
const toggledIntervalProduct2 = getToggledIntervalProduct(a0);
|
|
let r20 = null;
|
|
if (c19900_10) {
|
|
const r0 = toggledIntervalProduct2 != null;
|
|
r20 = null;
|
|
if (r0) {
|
|
let r13 = c19900_9 == null ? void 0 : c19900_9.getAvailablePlanForItems(getSubscriptionItemsForProduct(toggledIntervalProduct2));
|
|
if (r13 == null) {
|
|
r13 = null;
|
|
}
|
|
r20 = r13;
|
|
}
|
|
}
|
|
let c30535_2 = r20;
|
|
const r24 = c19900_10 ? r20 != null : toggledIntervalProduct2 != null && IAPStore_android.getProduct(toggledIntervalProduct2) != null;
|
|
if (toggledIntervalProduct2 != null && r24 && !shouldRemoveYearlyUpsell) {
|
|
trackPaymentFlowStep2({
|
|
fromStep: PaymentFlowStep.PLAN_SELECT,
|
|
toStep: PaymentFlowStep.YEARLY_UPSELL,
|
|
productId: a0
|
|
});
|
|
AlertActionCreators.openLazy({
|
|
importer: () => import("./PremiumPlanSelectYearlyUpsellModal").then(({ default: Component }) => (a0) => {
|
|
let orderPriceString = c30535_2 == null ? void 0 : c30535_2.getPriceString();
|
|
if (orderPriceString == null) {
|
|
orderPriceString = null;
|
|
}
|
|
return <Component {...a0} productId={toggledIntervalProduct2} orderPriceString={orderPriceString} continueWithDefault={async () => {
|
|
trackPaymentFlowStep2({
|
|
fromStep: PaymentFlowStep.YEARLY_UPSELL,
|
|
toStep: PaymentFlowStep.EXTERNAL_PAYMENT,
|
|
productId
|
|
});
|
|
await purchase3(productId, analyticsLoadId);
|
|
}} continueWithUpsell={async () => {
|
|
const newAnalyticsLoadId = getNewAnalyticsLoadId();
|
|
trackNewPaymentFlow2({
|
|
newFlowAnalyticsLoadId: newAnalyticsLoadId,
|
|
productId: toggledIntervalProduct2
|
|
});
|
|
await purchase3(toggledIntervalProduct2, newAnalyticsLoadId);
|
|
}} />;
|
|
}),
|
|
hideActionSheet: true,
|
|
isDismissable: true
|
|
});
|
|
return void 0;
|
|
}
|
|
trackPaymentFlowStep2({
|
|
fromStep: PaymentFlowStep.PLAN_SELECT,
|
|
toStep: PaymentFlowStep.EXTERNAL_PAYMENT,
|
|
productId: a0
|
|
});
|
|
return purchase3(a0, analyticsLoadId);
|
|
}
|
|
}, item.productId));
|
|
return shouldShowModernBoostFlow ? <TableRowGroup title={label} hasIcons>{r27}</TableRowGroup> : <View>{r27}</View>;
|
|
};
|
|
CurrentPlanRow = function CurrentPlanRow(props) {
|
|
let productIdFromSubscription, toggledIntervalProduct;
|
|
const { subscription: subscription3, trackPaymentFlowStep: trackPaymentFlowStep3, trackNewPaymentFlow: trackNewPaymentFlow3, purchase: purchase4, analyticsLoadId: analyticsLoadId2, showCurrentPlan, shouldRemoveYearlyUpsell: shouldRemoveYearlyUpsell2 } = props;
|
|
productIdFromSubscription = void 0;
|
|
toggledIntervalProduct = void 0;
|
|
const styles = useStyles();
|
|
if (showCurrentPlan && subscription3 != null) {
|
|
productIdFromSubscription = getProductIdFromSubscription(subscription3, true);
|
|
const premiumBundledItemsFromProductId = getPremiumBundledItemsFromProductId(productIdFromSubscription);
|
|
const premiumTier = premiumBundledItemsFromProductId.premiumTier;
|
|
const colors = premiumTier != null ? (0, getPremiumGradientColor)(premiumTier) : Gradients.PREMIUM_GUILD;
|
|
toggledIntervalProduct = getToggledIntervalProduct(productIdFromSubscription);
|
|
return <Module4611 style={styles.currentPlanGradient} colors={colors} start={HorizontalGradient.START} end={HorizontalGradient.END}>
|
|
<PlanRow plan={premiumBundledItemsFromProductId} subscription={subscription3} disabled={toggledIntervalProduct == null && subscription3.status !== SubscriptionStatusTypes.CANCELED} hasBackground purchase={() => {
|
|
let r23, r58;
|
|
const productIdsForBothIntervals = getProductIdsForBothIntervals(productIdFromSubscription);
|
|
const { monthly, yearly } = productIdsForBothIntervals;
|
|
if (subscription3?.status === SubscriptionStatusTypes.CANCELED) {
|
|
if (yearly != null && !shouldRemoveYearlyUpsell2) {
|
|
trackPaymentFlowStep3({
|
|
fromStep: PaymentFlowStep.PLAN_SELECT,
|
|
toStep: PaymentFlowStep.YEARLY_UPSELL,
|
|
productId: productIdFromSubscription
|
|
});
|
|
AlertActionCreators.openLazy({
|
|
importer: () => import("./PremiumPlanSelectYearlyUpsellModal").then(({ default: Component2 }) => (a0) => <Component2 {...a0} productId={yearly} continueWithUpsell={async () => {
|
|
const newAnalyticsLoadId = getNewAnalyticsLoadId();
|
|
trackNewPaymentFlow3({
|
|
newFlowAnalyticsLoadId: newAnalyticsLoadId,
|
|
productId: yearly
|
|
});
|
|
await purchase4(yearly, newAnalyticsLoadId);
|
|
}} continueWithDefault={async () => {
|
|
trackPaymentFlowStep3({
|
|
fromStep: PaymentFlowStep.YEARLY_UPSELL,
|
|
toStep: PaymentFlowStep.EXTERNAL_PAYMENT,
|
|
productId: monthly
|
|
});
|
|
await purchase4(monthly, analyticsLoadId2);
|
|
}} />),
|
|
hideActionSheet: true,
|
|
isDismissable: true
|
|
});
|
|
r58 = void 0;
|
|
} else {
|
|
trackPaymentFlowStep3({
|
|
fromStep: PaymentFlowStep.PLAN_SELECT,
|
|
toStep: PaymentFlowStep.EXTERNAL_PAYMENT,
|
|
productId: productIdFromSubscription
|
|
});
|
|
r58 = purchase4(productIdFromSubscription, analyticsLoadId2);
|
|
}
|
|
r23 = r58;
|
|
} else {
|
|
const r22 = toggledIntervalProduct != null;
|
|
r23 = void 0;
|
|
if (r22) {
|
|
const r26 = IAPStore_android.getProduct(toggledIntervalProduct) != null;
|
|
r23 = void 0;
|
|
if (r26) {
|
|
trackPaymentFlowStep3({
|
|
fromStep: PaymentFlowStep.PLAN_SELECT,
|
|
toStep: PaymentFlowStep.EXTERNAL_PAYMENT,
|
|
productId: toggledIntervalProduct
|
|
});
|
|
r23 = purchase4(toggledIntervalProduct, analyticsLoadId2);
|
|
}
|
|
}
|
|
}
|
|
return r23;
|
|
}} style={styles.currentPlanRow} />
|
|
</Module4611>;
|
|
}
|
|
return null;
|
|
};
|
|
PlanSectionHeader = function PlanSectionHeader({ string }) {
|
|
return (0, jsx)(LegacyText, {
|
|
style: useStyles().header,
|
|
accessibilityRole: "header",
|
|
children: string
|
|
});
|
|
};
|
|
PlanSections = function PlanSections(props) {
|
|
let productIdFromSubscription2, shouldRemoveYearlyUpsell3, mobileBoostingEnabled, showBoostOnlyLabels2, recommendedBoostCount2;
|
|
const { plans, subscription: subscription4, showCurrentPlan } = props;
|
|
let isBoostPurchaseFlow = props.isBoostPurchaseFlow;
|
|
const { analyticsLoadId: analyticsLoadId3, trackPaymentFlowStep: trackPaymentFlowStep4, trackNewPaymentFlow: trackNewPaymentFlow4, purchase: purchase5 } = props;
|
|
productIdFromSubscription2 = void 0;
|
|
shouldRemoveYearlyUpsell3 = void 0;
|
|
mobileBoostingEnabled = void 0;
|
|
showBoostOnlyLabels2 = void 0;
|
|
recommendedBoostCount2 = void 0;
|
|
const styles = useStyles();
|
|
let c19902_6 = (0, useNativeCheckoutStore)((a0) => a0.getCheckoutContextRecord());
|
|
productIdFromSubscription2 = subscription4 != null ? getProductIdFromSubscription(subscription4, false) : null;
|
|
shouldRemoveYearlyUpsell3 = isBoostPurchaseFlow ? getShouldRemoveYearlyUpsell("PremiumPlanSelect") : isBoostPurchaseFlow;
|
|
if (isBoostPurchaseFlow) {
|
|
isBoostPurchaseFlow = getMobileBoostingEnabled("PremiumPlanSelect");
|
|
}
|
|
mobileBoostingEnabled = isBoostPurchaseFlow;
|
|
const r43 = subscription4 != null && getPremiumTypeFromSubscription(subscription4) === PremiumTypes.TIER_2;
|
|
let r11 = mobileBoostingEnabled ? r43 : mobileBoostingEnabled;
|
|
showBoostOnlyLabels2 = r11;
|
|
recommendedBoostCount2 = mobileBoostingEnabled ? r43 ? null : getRecommendedBoostCount("PremiumPlanSelect") : null;
|
|
const r64 = c8676_43.map((item) => {
|
|
return {
|
|
section: item,
|
|
plansInSection: plans.filter((plan) => {
|
|
let r11 = plan.productId !== productIdFromSubscription2 && !productsHaveSamePerks(plan.productId, productIdFromSubscription2) && item.predicate(plan) && plan.premiumTier !== PremiumTypes.TIER_1;
|
|
if (r11) {
|
|
const isIOS = _Module501.isIOS();
|
|
r11 = (isIOS ? c19902_6 == null : !isIOS) || c19902_6.getAvailablePlanForItems(getSubscriptionItemsForProduct(plan.productId)) != null;
|
|
}
|
|
if (r11) {
|
|
const r44 = productIdFromSubscription2 == null;
|
|
let r45 = true;
|
|
if (!r44) {
|
|
const r53 = AppStorePremiumProductIdsToPremiumBundledItems[productIdFromSubscription2];
|
|
r45 = r53.premiumTier != null || plan.numPremiumGuild >= r53.numPremiumGuild;
|
|
}
|
|
r11 = r45;
|
|
}
|
|
return r11;
|
|
})
|
|
};
|
|
}).filter((item) => item.plansInSection.length > 0);
|
|
const r67 = r64.some((item) => item.section.id === "premium-and-premium-guild");
|
|
const r68 = showBoostOnlyLabels2 ? r67 ? r64.filter((item) => item.section.id !== "premium-guild") : r64 : r64;
|
|
const style = [styles.container, ,];
|
|
if (mobileBoostingEnabled) {
|
|
isBoostPurchaseFlow = styles.boostContainer;
|
|
}
|
|
style[1] = isBoostPurchaseFlow;
|
|
if (showBoostOnlyLabels2) {
|
|
r11 = (0, jsx)(BoostPurchaseNitroBanner, {});
|
|
}
|
|
return <View style={style}>
|
|
{r11}
|
|
{(0, jsx)(CurrentPlanRow, {
|
|
subscription: subscription4,
|
|
analyticsLoadId: analyticsLoadId3,
|
|
purchase: purchase5,
|
|
trackPaymentFlowStep: trackPaymentFlowStep4,
|
|
trackNewPaymentFlow: trackNewPaymentFlow4,
|
|
showCurrentPlan,
|
|
shouldRemoveYearlyUpsell: shouldRemoveYearlyUpsell3
|
|
})}
|
|
{r68.map((item) => {
|
|
const section = item.section;
|
|
const { id, getLabel: getLabel2 } = section;
|
|
const plansInSection = item.plansInSection;
|
|
const string = getLabel2(showBoostOnlyLabels2);
|
|
return <View key={id}>
|
|
{mobileBoostingEnabled ? !mobileBoostingEnabled : (0, jsx)(PlanSectionHeader, {
|
|
string
|
|
})}
|
|
{(0, jsx)(PlanSection, {
|
|
trackPaymentFlowStep: trackPaymentFlowStep4,
|
|
trackNewPaymentFlow: trackNewPaymentFlow4,
|
|
analyticsLoadId: analyticsLoadId3,
|
|
plans: plansInSection,
|
|
label: string,
|
|
shouldShowModernBoostFlow: mobileBoostingEnabled,
|
|
showBoostOnlyLabels: showBoostOnlyLabels2,
|
|
recommendedBoostCount: recommendedBoostCount2,
|
|
purchase: purchase5,
|
|
subscription: subscription4,
|
|
shouldRemoveYearlyUpsell: shouldRemoveYearlyUpsell3
|
|
})}
|
|
</View>;
|
|
})}
|
|
</View>;
|
|
};
|
|
const { Fonts, USER_SETTINGS_CONTAINER_HORIZONTAL_PADDING } = _Constants;
|
|
useStyles = createStyles({
|
|
header: {
|
|
...TextStyles(Fonts.DISPLAY_EXTRABOLD, void 0, 24),
|
|
marginTop: 16,
|
|
color: DARK_WHITE_500_LIGHT_BLACK_500
|
|
},
|
|
row: {
|
|
marginTop: 7,
|
|
borderRadius: Module712.radii.sm,
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
paddingVertical: 12,
|
|
paddingHorizontal: 12,
|
|
flexWrap: "wrap",
|
|
backgroundColor: DARK_PRIMARY_630_LIGHT_PRIMARY_230
|
|
},
|
|
rowDisabled: {
|
|
opacity: 0.5
|
|
},
|
|
imgWumpusNitro: {
|
|
height: 40,
|
|
width: 40
|
|
},
|
|
imgBoost: {
|
|
height: 40,
|
|
width: 40
|
|
},
|
|
imgWumpusNitroBoost: {
|
|
width: 32,
|
|
height: 32
|
|
},
|
|
imgWumpusNitroClassic: {
|
|
width: 40,
|
|
height: 40
|
|
},
|
|
imgWumpusNitroClassicBoost: {
|
|
width: 32,
|
|
height: 32
|
|
},
|
|
imgWumpusNitroTier0: {
|
|
width: 40,
|
|
height: 40
|
|
},
|
|
rowText: {
|
|
fontSize: 16,
|
|
color: DARK_WHITE_500_LIGHT_BLACK_500
|
|
},
|
|
rowPlanDescription: {
|
|
marginLeft: 12,
|
|
fontFamily: Fonts.PRIMARY_SEMIBOLD,
|
|
lineHeight: 20
|
|
},
|
|
rowPlanDescriptionSubtext: {
|
|
fontSize: 12,
|
|
marginLeft: 5,
|
|
fontFamily: Fonts.PRIMARY_MEDIUM,
|
|
fontWeight: "400"
|
|
},
|
|
rowPrice: {
|
|
marginLeft: "auto"
|
|
},
|
|
purchasingSpinner: {
|
|
position: "absolute",
|
|
top: 0,
|
|
bottom: 0,
|
|
left: 0,
|
|
right: 0,
|
|
alignItems: "center",
|
|
justifyContent: "center"
|
|
},
|
|
container: {
|
|
marginHorizontal: 14.5,
|
|
paddingBottom: 10
|
|
},
|
|
currentPlanGradient: {
|
|
marginTop: 20,
|
|
borderRadius: Module712.radii.sm
|
|
},
|
|
currentPlanRow: {
|
|
marginTop: 0.5,
|
|
marginRight: 0.5,
|
|
marginLeft: 0.5,
|
|
marginBottom: 0.5
|
|
},
|
|
loadingSpinnerContainer: {
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
height: "100%"
|
|
},
|
|
offPlatformSubscriptionMessage: {
|
|
lineHeight: 20,
|
|
marginTop: 40,
|
|
margin: USER_SETTINGS_CONTAINER_HORIZONTAL_PADDING
|
|
},
|
|
premiumHeaderLabel: {
|
|
paddingHorizontal: USER_SETTINGS_CONTAINER_HORIZONTAL_PADDING,
|
|
marginTop: 8
|
|
},
|
|
boostContainer: {
|
|
rowGap: Module712.space.PX_24
|
|
},
|
|
boostRowIcon: {
|
|
width: 32,
|
|
height: 32
|
|
},
|
|
nitroBanner: {
|
|
alignItems: "center",
|
|
paddingTop: Module712.space.PX_16,
|
|
paddingHorizontal: USER_SETTINGS_CONTAINER_HORIZONTAL_PADDING
|
|
},
|
|
nitroBannerText: {
|
|
textAlign: "center"
|
|
},
|
|
recommendedText: {
|
|
color: Module712.unsafe_rawColors.GUILD_BOOSTING_PINK
|
|
}
|
|
});
|
|
const r148 = {};
|
|
r148[Module12577] = "imgWumpusNitro";
|
|
r148[Module12579] = "imgWumpusNitroBoost";
|
|
r148[Module12576] = "imgWumpusNitroClassic";
|
|
r148[Module12578] = "imgWumpusNitroClassicBoost";
|
|
r148[Module12575] = "imgWumpusNitroTier0";
|
|
r148[Module12574] = "imgBoost";
|
|
c8676_38 = r148;
|
|
c8676_43 = [{
|
|
id: "premium",
|
|
getLabel: () => intl.string(t.A4BfLn),
|
|
predicate: (a0) => a0.premiumTier != null && a0.numPremiumGuild === 0
|
|
}, {
|
|
id: "premium-and-premium-guild",
|
|
getLabel: (a0) => intl.string(a0 ? t.rPoOQW : t.lyXyD0),
|
|
predicate: (a0) => a0.premiumTier != null && a0.numPremiumGuild !== 0
|
|
}, {
|
|
id: "premium-guild",
|
|
getLabel: () => intl.string(t.rPoOQW),
|
|
predicate: (a0) => a0.premiumTier == null && a0.numPremiumGuild !== 0
|
|
}];
|
|
PremiumPlanSelect = forwardRef(function PremiumPlanSelect(props, a1) {
|
|
let r120, r173;
|
|
const { predicate: predicate2, showCurrentPlan = true, isBoostPurchaseFlow = false } = props;
|
|
let env19903 = {
|
|
$parent: env8676
|
|
};
|
|
const { analyticsLocation, planId, applicationId } = props;
|
|
env19903[0] = applicationId;
|
|
env19903[1] = void 0;
|
|
env19903[2] = void 0;
|
|
env19903[3] = void 0;
|
|
env19903[4] = void 0;
|
|
env19903[5] = void 0;
|
|
env19903[6] = void 0;
|
|
env19903[7] = void 0;
|
|
env19903[8] = void 0;
|
|
const styles = useStyles();
|
|
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
|
|
const [r43, r44] = useStateFromStoresArray([SubscriptionStore, SubscriptionPlanStore], () => [SubscriptionStore.hasFetchedSubscriptions(), SubscriptionPlanStore.isLoadedForPremiumSKUs()]);
|
|
env19903[1] = r44;
|
|
useEffect(() => {
|
|
if (!env19903[1]) {
|
|
fetchPremiumSubscriptionPlans();
|
|
}
|
|
}, [r44]);
|
|
const initialValue = useInitialValue(() => getNewAnalyticsLoadId());
|
|
const basePurchaseFlowAnalyticsFields = getBasePurchaseFlowAnalyticsFields({
|
|
analyticsLoadId: initialValue,
|
|
analyticsLocation: {
|
|
object: AnalyticsObjects.BUTTON_CTA,
|
|
object_type: AnalyticsObjectTypes.BUY,
|
|
...analyticsLocation
|
|
},
|
|
analyticsLocations
|
|
});
|
|
env19903[2] = basePurchaseFlowAnalyticsFields;
|
|
env19903[3] = planId != null ? {
|
|
subscription_plan_id: planId
|
|
} : {};
|
|
useMountEffect(() => {
|
|
trackPaymentFlowStartedAnalyticsAndCTP({
|
|
...env19903[2],
|
|
...env19903[3],
|
|
application_id: env19903[0]
|
|
});
|
|
});
|
|
const activeSubscription = useNativeCheckoutStore((a0) => ({
|
|
activeSubscription: a0.checkoutInitParameters.activeSubscription,
|
|
order: a0.orderRecord
|
|
})).activeSubscription;
|
|
const handlePremiumPurchase = useHandlePremiumPurchase();
|
|
env19903[4] = handlePremiumPurchase;
|
|
const navigation2 = useNavigation();
|
|
env19903[5] = navigation2;
|
|
const isPaymentsBlocked = useIsPaymentsBlocked();
|
|
const r83 = activeSubscription != null ? {
|
|
subscriptionId: activeSubscription.id,
|
|
renewal: true,
|
|
analyticsLocations,
|
|
analyticsLocation: AnalyticsLocation.PREMIUM_PLAN_SELECT
|
|
} : {};
|
|
let c19904_0;
|
|
const [renewalInvoicePreview] = useFetchSubscriptionInvoicePreview(r83);
|
|
const nativeCheckoutStore = useNativeCheckoutStore((a0) => ({
|
|
patchOrderLineItems: a0.patchOrderLineItems,
|
|
isPatchOrderLoading: a0.isPatchOrderLoading,
|
|
orderRequired: a0.orderRequired
|
|
}));
|
|
const patchOrderLineItems = nativeCheckoutStore.patchOrderLineItems;
|
|
env19903[6] = patchOrderLineItems;
|
|
const orderRequired = nativeCheckoutStore.orderRequired;
|
|
env19903[7] = orderRequired;
|
|
const stateFromStores3 = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getPremiumTypeSubscription());
|
|
env19903[8] = stateFromStores3;
|
|
c19904_0 = void 0;
|
|
c19904_0 = async (c30536_0, c30536_1) => {
|
|
let c30536_2, c30536_3, c30536_4;
|
|
let c30536_5 = 0;
|
|
const r13 = void 0;
|
|
const r12 = env19903;
|
|
L18: {
|
|
try {
|
|
let env31660;
|
|
c30536_3 = r13;
|
|
const r38 = env31660 = {
|
|
$parent: r12
|
|
};
|
|
c30536_2 = r38;
|
|
env31660[0] = c30536_0;
|
|
env31660[1] = c30536_1;
|
|
env31660[2] = void 0;
|
|
(0, setIsPurchasing)(true, c30536_0);
|
|
const r21 = env19903[8];
|
|
const r20 = r21 != null ? getModifySubscriptionItemsForProduct(c30536_0, r21) : getSubscriptionItemsForProduct(c30536_0);
|
|
env31660[2] = void 0;
|
|
if (env19903[7]) {
|
|
const r30 = await (0, env19903[6])(r20.map((item) => ({
|
|
sku_id: castPremiumSubscriptionAsSkuId(PremiumUtils.getSkuIdForPlan(item.planId)),
|
|
subscription_plan_id: item.planId,
|
|
quantity: item.quantity,
|
|
purchase_type: ItemPurchaseType.SUBSCRIPTION
|
|
})));
|
|
env31660[2] = r30;
|
|
if (r30 != null) {
|
|
c30536_5 = 1;
|
|
await env19903[4]({
|
|
productId: env31660[0],
|
|
analyticsLocation: env19903[2].location,
|
|
analyticsLoadId: env31660[1],
|
|
applicationId: env19903[0],
|
|
orderId: env31660[2]?.id,
|
|
onPurchaseComplete: $mk118358(c30536_2)
|
|
});
|
|
c30536_5 = 0;
|
|
(0, setIsPurchasing)(false);
|
|
} else {
|
|
(0, setIsPurchasing)(false);
|
|
}
|
|
} else {
|
|
c30536_5 = 1;
|
|
await env19903[4]({
|
|
productId: env31660[0],
|
|
analyticsLocation: env19903[2].location,
|
|
analyticsLoadId: env31660[1],
|
|
applicationId: env19903[0],
|
|
orderId: env31660[2]?.id,
|
|
onPurchaseComplete: $mk118358(c30536_2)
|
|
});
|
|
c30536_5 = 0;
|
|
(0, setIsPurchasing)(false);
|
|
}
|
|
} catch ($e) {
|
|
const r36 = $e;
|
|
let r7 = r36;
|
|
c30536_4 = r36;
|
|
if (c30536_5 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r171 = c30536_4;
|
|
c30536_5 = 0;
|
|
if (r171 instanceof InvalidGooglePlayPurchase) {
|
|
fetchSubscriptions();
|
|
AlertActionCreators.show({
|
|
title: intl.string(t["U+H+kd"]),
|
|
body: intl.string(t.yyDkbE)
|
|
});
|
|
} else {
|
|
AlertActionCreators.show({
|
|
title: intl.string(t.zrhHH3),
|
|
body: intl.string(t.PjfUXe),
|
|
isDismissable: true
|
|
});
|
|
}
|
|
(0, setIsPurchasing)(false);
|
|
break L18;
|
|
} catch (r168) {
|
|
r7 = r168;
|
|
c30536_4 = r168;
|
|
if (c30536_5 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r7;
|
|
}
|
|
}
|
|
};
|
|
const callback = useCallback(function() {
|
|
return c19904_0.apply(this, arguments);
|
|
}, [basePurchaseFlowAnalyticsFields.location, applicationId, handlePremiumPurchase, navigation2, patchOrderLineItems, orderRequired, stateFromStores3]);
|
|
const r3 = predicate2 == null;
|
|
let r110 = null;
|
|
if (!r3) {
|
|
if (r43 && r44) {
|
|
L24: {
|
|
if (isPaymentsBlocked) {
|
|
r173 = <ScrollView ref={a1} contentInset={{
|
|
top: 40
|
|
}}>
|
|
<BlockedPaymentsCountryDisplay />
|
|
</ScrollView>;
|
|
} else {
|
|
L21: {
|
|
if (activeSubscription != null) {
|
|
if (activeSubscription.isOnPlatformMatchingExternalPaymentGateway && isValidBundleProductId(getProductIdFromSubscription(activeSubscription, false))) {
|
|
break L21;
|
|
}
|
|
r173 = <ScrollView>
|
|
{renewalInvoicePreview != null && <>
|
|
<Text style={styles.premiumHeaderLabel} variant="eyebrow" color="text-default" accessibilityRole="header">
|
|
{intl.string(t.ITurwY)}
|
|
</Text>
|
|
<PremiumSubscriptionHeader subscription={activeSubscription} renewalInvoicePreview={renewalInvoicePreview} />
|
|
</>}
|
|
{(0, jsx)(Text, {
|
|
style: styles.offPlatformSubscriptionMessage,
|
|
variant: "text-md/semibold",
|
|
children: getExternalManagementMessage(activeSubscription, {
|
|
shouldAllowExternalManagement: true
|
|
})
|
|
})}
|
|
</ScrollView>;
|
|
break L24;
|
|
}
|
|
}
|
|
r173 = <ScrollView ref={a1}>
|
|
<PlanSections subscription={activeSubscription} plans={getPremiumBundlesWithPredicate(predicate2)} showCurrentPlan={showCurrentPlan} isBoostPurchaseFlow={isBoostPurchaseFlow} analyticsLoadId={initialValue} trackPaymentFlowStep={(a0) => {
|
|
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_STEP, {
|
|
application_id: env19903[0],
|
|
...getPaymentFlowStepAnalyticsFields(env19903[2], {
|
|
from_step: a0.fromStep,
|
|
to_step: a0.toStep,
|
|
subscription_plan_gateway_plan_id: a0.productId
|
|
})
|
|
});
|
|
}} trackNewPaymentFlow={(a0) => {
|
|
trackPaymentFlowStartedAnalyticsAndCTP({
|
|
...env19903[2],
|
|
subscription_plan_gateway_plan_id: a0.productId,
|
|
load_id: a0.newFlowAnalyticsLoadId,
|
|
application_id: env19903[0]
|
|
});
|
|
}} purchase={callback} />
|
|
</ScrollView>;
|
|
}
|
|
}
|
|
r120 = r173;
|
|
} else {
|
|
r120 = <View style={styles.loadingSpinnerContainer}>
|
|
<ActivityIndicator animating size="large" />
|
|
</View>;
|
|
}
|
|
r110 = r120;
|
|
}
|
|
return r110;
|
|
});
|
|
export default function PremiumPlanSelectWithOrderCTX(props) {
|
|
let r13, APPLE_ADVANCED_COMMERCE, PaymentGateways2, paymentGateway;
|
|
let stateFromStores, stateFromStores2, mobileBoostingEnabled2;
|
|
let c19905_0 = props;
|
|
const styles = useStyles();
|
|
const navigation = useNavigation();
|
|
const stateFromStores3 = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getPremiumTypeSubscription());
|
|
const enabled = NitroACOMSubscriptionExperiment.useConfig({
|
|
location: "PremiumPlanSelectWithOrderCTX"
|
|
}).enabled;
|
|
if (_Module501.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;
|
|
}
|
|
if (stateFromStores3 != null) {
|
|
paymentGateway = stateFromStores3.paymentGateway;
|
|
}
|
|
const defaultPlans = [{
|
|
subscriptionPlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
|
|
skuId: castPremiumSubscriptionAsSkuId(PremiumSubscriptionSKUs.TIER_2),
|
|
quantity: 1
|
|
}];
|
|
stateFromStores = useStateFromStores([SubscriptionStore], () => SubscriptionStore.hasFetchedSubscriptions());
|
|
useEffect(() => {
|
|
if (!stateFromStores) {
|
|
fetchSubscriptions();
|
|
}
|
|
}, [stateFromStores]);
|
|
stateFromStores2 = useStateFromStores([GuildStore], () => c19905_0.guildId != null ? GuildStore.getGuild(c19905_0.guildId)?.name : void 0);
|
|
mobileBoostingEnabled2 = props.isBoostPurchaseFlow === true && getMobileBoostingEnabled("PremiumPlanSelect");
|
|
useLayoutEffect(() => {
|
|
navigation.setOptions({
|
|
title: mobileBoostingEnabled2 && stateFromStores2 != null ? intl.formatToPlainString(t.LcefAL, {
|
|
server: stateFromStores2
|
|
}) : intl.string(t.u95Dt4)
|
|
});
|
|
}, [navigation, mobileBoostingEnabled2, stateFromStores2]);
|
|
if (stateFromStores) {
|
|
L16: {
|
|
if (paymentGateway != null) {
|
|
if (stateFromStores3 != null && stateFromStores3.isPurchasedExternally === false) {
|
|
break L16;
|
|
}
|
|
return <NativeCheckoutStoreProvider paymentGateway={paymentGateway} orderRequired={paymentGateway === r13.APPLE_ADVANCED_COMMERCE} skuIds={[]} defaultPlans={defaultPlans} isGift={false} activeSubscription={stateFromStores3} onOrderRetryCancellation={() => {
|
|
if (navigation.canGoBack()) {
|
|
navigation.goBack();
|
|
} else {
|
|
navigation.pop();
|
|
}
|
|
}}>
|
|
<PremiumPlanSelect {...props} />
|
|
</NativeCheckoutStoreProvider>;
|
|
}
|
|
}
|
|
return <View>
|
|
<Text variant="display-md">
|
|
{intl.format(t.CnoyAN, {
|
|
mobilePlatform: _Module501.isIOS() ? "iOS" : "Android"
|
|
})}
|
|
</Text>
|
|
</View>;
|
|
}
|
|
return <View style={styles.loadingSpinnerContainer}>
|
|
<ActivityIndicator animating size="large" />
|
|
</View>;
|
|
};
|