Files
discord-decomp/modules/storefront/native/StorefrontNativeUtils.android.tsx
T
2026-11-01 12:12:55 +02:00

37 lines
1.2 KiB
TypeScript

// Metro module 9758 (f9759).
import { useEffect, useMemo } from "react";
import { loadInAppSkus } from "../../../actions/native/GPlayActionCreators";
import { useStateFromStores } from "../../../_bundle/Module589";
import IAPStore_android from "../../../stores/native/IAPStore.android";
export function useFormattedSKUPrice({ sku, priceSetAssignmentPurchaseType }) {
let stateFromStores;
stateFromStores = void 0;
const r2 = sku == null;
let r10 = void 0;
if (!r2) {
const googleSkuIds = sku.googleSkuIds;
r10 = googleSkuIds == null ? void 0 : googleSkuIds[priceSetAssignmentPurchaseType];
}
if (r10 == null) {
r10 = null;
}
let c17466_0 = r10;
useEffect(() => {
if (c17466_0 != null) {
loadInAppSkus([c17466_0]);
}
}, [r10]);
stateFromStores = useStateFromStores([IAPStore_android], () => c17466_0 != null ? IAPStore_android.getProduct(c17466_0) : null, [r10]);
return useMemo(() => stateFromStores?.priceString != null ? {
normalPrice: stateFromStores.priceString,
discountedPrice: null,
discountPercent: null,
userPrice: stateFromStores.priceString
} : {
normalPrice: null,
discountedPrice: null,
discountPercent: null,
userPrice: null
}, [stateFromStores]);
}