29 lines
1.3 KiB
TypeScript
29 lines
1.3 KiB
TypeScript
// Metro module 6292 (f6293).
|
|
import { useEffect } from "react";
|
|
import AuthenticationStore from "../../../stores/AuthenticationStore";
|
|
import BillingInfoStore from "../../../stores/billing/BillingInfoStore";
|
|
import IAPStore_android from "../../../stores/native/IAPStore.android";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import { ProductIds } from "../native/ProductIds.ios";
|
|
import { fetchIpLocation } from "../../billing/actions/BillingActionCreators";
|
|
export default function useGeoForUser() {
|
|
let stateFromStores;
|
|
const stateFromStores2 = useStateFromStores([IAPStore_android], () => IAPStore_android.getProduct(ProductIds.PREMIUM_TIER_2_MONTHLY)?.countryCode);
|
|
const stateFromStores3 = useStateFromStores([BillingInfoStore], () => BillingInfoStore.ipLocation);
|
|
stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.isAuthenticated());
|
|
useEffect(() => {
|
|
let r3 = stateFromStores;
|
|
if (stateFromStores) {
|
|
r3 = !BillingInfoStore.ipLocationLoaded;
|
|
}
|
|
if (r3) {
|
|
fetchIpLocation();
|
|
}
|
|
}, [stateFromStores3, stateFromStores]);
|
|
return {
|
|
defaultBillingCountryCode: stateFromStores2,
|
|
ipCountryCode: stateFromStores3?.countryCode,
|
|
ipSubdivisionCode: stateFromStores3?.subdivisionCode
|
|
};
|
|
};
|