Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
148 lines
5.4 KiB
TypeScript
148 lines
5.4 KiB
TypeScript
// Module ID: 9494
|
|
// Function ID: 9495
|
|
// Name: usePremiumPlanPrice
|
|
// Dependencies: [19, 4299, 4300, 7340, 1085, 504, 9495, 9496, 9499, 7343, 1150, 5679, 559, 7360, 7337, 2]
|
|
// Exports: default
|
|
|
|
// Module 9494 (usePremiumPlanPrice)
|
|
import SubscriptionPlanActionCreators from "SubscriptionPlanActionCreators" /* 7360 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import SubscriptionPlanStore from "SubscriptionPlanStore" /* 4299 */;
|
|
import SubscriptionStore from "SubscriptionStore" /* 4300 */;
|
|
import IAPStore from "IAPStore" /* 7340 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
require = fn;
|
|
const PaymentGateways = fn(1085).PaymentGateways;
|
|
const PremiumPlanPriceSource = { IAP: "IAP", API: "API" };
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/premium/native/hooks/usePremiumPlanPrice.tsx");
|
|
|
|
export default function usePremiumPlanPrice(arg0) {
|
|
_require = arg0;
|
|
let formatPrice = _require;
|
|
let amount = priceState;
|
|
let obj = require("initialize");
|
|
const items = [closure_5];
|
|
const stateFromStores = obj.useStateFromStores(items, () => closure_5.getPremiumTypeSubscription());
|
|
const NitroACOMSubscriptionExperiment = require("ACOMExperiments").NitroACOMSubscriptionExperiment;
|
|
let enabled = NitroACOMSubscriptionExperiment.useConfig({ location: "usePremiumPlanPrice" }).enabled;
|
|
mobileStoreFront = mobileStoreFront(priceState[7]).useMobileStoreFront();
|
|
const obj2 = mobileStoreFront(priceState[7]);
|
|
const tmp2 = mobileStoreFront;
|
|
const items1 = [SubscriptionPlanStore];
|
|
const items2 = [arg0];
|
|
const stateFromStores1 = require("initialize").useStateFromStores(items1, () => {
|
|
value = null;
|
|
if (null != closure_0) {
|
|
value = SubscriptionPlanStore.get(tmp);
|
|
}
|
|
return value;
|
|
}, items2);
|
|
const obj3 = require("initialize");
|
|
({ price, priceState } = mobileStoreFront(priceState[8])(stateFromStores1, mobileStoreFront));
|
|
let tmp6 = null;
|
|
let tmp7 = null;
|
|
if (null != arg0) {
|
|
tmp7 = formatPrice(amount[9]).BasePlanIdToProductId[arg0];
|
|
}
|
|
noop = tmp7;
|
|
const tmp5 = mobileStoreFront(priceState[8])(stateFromStores1, mobileStoreFront);
|
|
const items3 = [IAPStore];
|
|
const items4 = [tmp7];
|
|
const stateFromStores2 = formatPrice(amount[5]).useStateFromStores(items3, () => {
|
|
let product = null;
|
|
if (null != closure_3) {
|
|
product = IAPStore.getProduct(tmp);
|
|
}
|
|
return product;
|
|
}, items4);
|
|
const formatPriceResult = formatPrice(amount[5]);
|
|
let isIOSResult = formatPrice(amount[10]).isIOS();
|
|
if (isIOSResult) {
|
|
if (!enabled) {
|
|
let isACOM;
|
|
if (stateFromStores != tmp6) {
|
|
isACOM = stateFromStores.isACOM;
|
|
}
|
|
enabled = true === isACOM;
|
|
}
|
|
isIOSResult = enabled;
|
|
}
|
|
SubscriptionPlanStore = isIOSResult;
|
|
const tmp11 = tmp2(amount[11])(() => new mobileStoreFront(priceState[12])(500, 10000));
|
|
closure_5 = tmp11;
|
|
const items5 = [isIOSResult, priceState, mobileStoreFront, tmp11];
|
|
const effect = noop.useEffect(() => {
|
|
if (closure_4) {
|
|
if (priceState !== closure_0(priceState[8]).PriceStates.PRICE_AVAILABLE) {
|
|
if (tmp === tmp2(tmp3[8]).PriceStates.MISMATCHING_COUNTRIES) {
|
|
let country;
|
|
if (mobileStoreFront != null) {
|
|
country = tmp6.country;
|
|
}
|
|
if (null != country) {
|
|
if (!closure_5.pending) {
|
|
if (!isIOSResult.isFetchingForPremiumSKUs()) {
|
|
if (obj.fails < 3) {
|
|
country = tmp6.country;
|
|
obj.fail(() => {
|
|
if (!SubscriptionPlanStore.isFetchingForPremiumSKUs()) {
|
|
const obj = SubscriptionPlanActionCreators;
|
|
const premiumSubscriptionPlans = obj.fetchPremiumSubscriptionPlans(country, undefined, undefined, PaymentGateways.APPLE_ADVANCED_COMMERCE);
|
|
premiumSubscriptionPlans.catch(() => {
|
|
|
|
});
|
|
}
|
|
});
|
|
return () => {
|
|
closure_1_5.cancel();
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
closure_5.succeed();
|
|
}
|
|
}
|
|
}, items5);
|
|
if (tmp6 == arg0) {
|
|
return null;
|
|
} else if (isIOSResult) {
|
|
if (priceState === formatPrice(amount[8]).PriceStates.PRICE_AVAILABLE) {
|
|
if (tmp6 != price) {
|
|
const obj4 = { price: null, currency: null, countryCode: null, priceString: null, source: null };
|
|
({ amount: obj7.price, currency: obj7.currency } = price);
|
|
tmp6 = mobileStoreFront == tmp6;
|
|
let country;
|
|
if (!tmp6) {
|
|
country = mobileStoreFront.country;
|
|
}
|
|
obj4.countryCode = country;
|
|
priceState = formatPrice(amount[14]);
|
|
formatPrice = priceState.formatPrice;
|
|
amount = price.amount;
|
|
price = formatPrice(amount, price.currency);
|
|
obj4.priceString = price;
|
|
obj4.source = obj.API;
|
|
}
|
|
}
|
|
} else if (tmp6 != stateFromStores2) {
|
|
const obj5 = { price: null, currency: null, countryCode: null, priceString: null, source: null };
|
|
({ price: obj6.price, currencyCode: obj6.currency } = stateFromStores2);
|
|
let country1;
|
|
if (mobileStoreFront != tmp6) {
|
|
country1 = mobileStoreFront.country;
|
|
}
|
|
if (country1 == tmp6) {
|
|
country1 = stateFromStores2.countryCode;
|
|
}
|
|
obj5.countryCode = country1;
|
|
obj5.priceString = stateFromStores2.priceString;
|
|
obj5.source = obj.IAP;
|
|
}
|
|
};
|
|
export { PremiumPlanPriceSource };
|