43 lines
1.7 KiB
TypeScript
43 lines
1.7 KiB
TypeScript
// Metro module 6573 (f6574).
|
|
import { useMemo } from "react";
|
|
import { PriceSetAssignmentPurchaseTypes } from "../../../../Constants";
|
|
import { getCountryPrices, experimentalGetPrice } from "../../../../utils/PremiumUtils";
|
|
let c4232_4 = {
|
|
PRICE_AVAILABLE: "PRICE_AVAILABLE",
|
|
SUBSCRIPTION_PLAN_UNAVAILABLE: "SUBSCRIPTION_PLAN_UNAVAILABLE",
|
|
STOREFRONT_UNAVAILABLE: "STOREFRONT_UNAVAILABLE",
|
|
MISMATCHING_COUNTRIES: "MISMATCHING_COUNTRIES",
|
|
COUNTRY_PRICE_UNAVAILABLE: "COUNTRY_PRICE_UNAVAILABLE"
|
|
};
|
|
export default function useStoreFrontPrice(a0, a1) {
|
|
return useMemo(() => {
|
|
let SUBSCRIPTION_PLAN_UNAVAILABLE, price;
|
|
if (a0 == null) {
|
|
SUBSCRIPTION_PLAN_UNAVAILABLE = c4232_4.SUBSCRIPTION_PLAN_UNAVAILABLE;
|
|
price = void 0;
|
|
} else if (a1 == null) {
|
|
SUBSCRIPTION_PLAN_UNAVAILABLE = c4232_4.STOREFRONT_UNAVAILABLE;
|
|
price = void 0;
|
|
} else {
|
|
const prices = a0.prices;
|
|
if ((prices == null ? void 0 : prices[PriceSetAssignmentPurchaseTypes.MOBILE]) == null) {
|
|
SUBSCRIPTION_PLAN_UNAVAILABLE = c4232_4.COUNTRY_PRICE_UNAVAILABLE;
|
|
price = void 0;
|
|
} else {
|
|
const countryPrices = getCountryPrices(a0.id, PriceSetAssignmentPurchaseTypes.MOBILE);
|
|
const r29 = experimentalGetPrice(a0.id, {
|
|
purchaseType: PriceSetAssignmentPurchaseTypes.MOBILE,
|
|
currency: a1.currency
|
|
});
|
|
SUBSCRIPTION_PLAN_UNAVAILABLE = countryPrices.countryCode !== a1.country ? c4232_4.MISMATCHING_COUNTRIES : r29 == null ? c4232_4.COUNTRY_PRICE_UNAVAILABLE : c4232_4.PRICE_AVAILABLE;
|
|
price = r29;
|
|
}
|
|
}
|
|
return {
|
|
price,
|
|
priceState: SUBSCRIPTION_PLAN_UNAVAILABLE
|
|
};
|
|
}, [a0, a1]);
|
|
};
|
|
export { c4232_4 as PriceStates };
|