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,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]);
}