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

24 lines
1.0 KiB
TypeScript

// 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;
}