decord/source/modules/premium/native/hooks/usePremiumPlanPrice.tsx

151 lines
5 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 7543
// Function ID: 7544
2026-07-20 16:05:17 +00:00
// Name: usePremiumPlanPrice
2026-08-05 07:35:12 +00:00
// Dependencies: [19, 3906, 3907, 5752, 505, 589, 7305, 7544, 7545, 5755, 500, 5583, 584, 5771, 5749, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-05 07:35:12 +00:00
// Module 7543 (usePremiumPlanPrice)
2026-07-29 08:29:29 +00:00
import noop from "noop";
import addSubscriptionPlan from "addSubscriptionPlan";
import reset from "reset";
import updateProduct from "updateProduct";
2026-07-23 10:11:24 +00:00
import { PaymentGateways } from "sum";
const require = arg1;
2026-07-29 08:29:29 +00:00
const result = require("reset").fileFinishedImporting("modules/premium/native/hooks/usePremiumPlanPrice.tsx");
2026-07-20 16:05:17 +00:00
export default function usePremiumPlanPrice(arg0) {
let price;
let priceState;
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-07-29 08:29:29 +00:00
let formatPrice = _require;
let amount = priceState;
2026-07-23 10:11:24 +00:00
let obj = _require(priceState[5]);
2026-07-29 08:29:29 +00:00
const items = [reset];
const stateFromStores = obj.useStateFromStores(items, () => tmp10.getPremiumTypeSubscription());
2026-07-23 10:11:24 +00:00
const NitroACOMSubscriptionExperiment = _require(priceState[6]).NitroACOMSubscriptionExperiment;
2026-07-20 16:05:17 +00:00
let enabled = NitroACOMSubscriptionExperiment.useConfig({ location: "usePremiumPlanPrice" }).enabled;
2026-07-23 10:11:24 +00:00
storeFront = storeFront(priceState[7]).useNativeIAPPayments().storeFront;
const obj2 = storeFront(priceState[7]);
2026-07-29 08:29:29 +00:00
const tmp2 = storeFront;
const items1 = [addSubscriptionPlan];
2026-07-20 16:05:17 +00:00
const items2 = [arg0];
2026-07-23 10:11:24 +00:00
const stateFromStores1 = _require(priceState[5]).useStateFromStores(items1, () => {
2026-07-20 16:05:17 +00:00
let value = null;
2026-07-23 10:11:24 +00:00
if (null != closure_0) {
2026-07-29 08:29:29 +00:00
value = isIOSResult.get(tmp);
2026-07-20 16:05:17 +00:00
}
return value;
}, items2);
2026-07-23 10:11:24 +00:00
const obj3 = _require(priceState[5]);
({ price, priceState } = storeFront(priceState[8])(stateFromStores1, storeFront));
2026-07-29 08:29:29 +00:00
let tmp5 = null;
2026-07-20 16:05:17 +00:00
let tmp6 = null;
if (null != arg0) {
2026-07-29 08:29:29 +00:00
tmp6 = formatPrice(amount[9]).BasePlanIdToProductId[arg0];
2026-07-20 16:05:17 +00:00
}
const React = tmp6;
2026-07-23 10:11:24 +00:00
const tmp4 = storeFront(priceState[8])(stateFromStores1, storeFront);
2026-07-29 08:29:29 +00:00
const items3 = [updateProduct];
2026-07-20 16:05:17 +00:00
const items4 = [tmp6];
2026-07-29 08:29:29 +00:00
const stateFromStores2 = formatPrice(amount[5]).useStateFromStores(items3, () => {
2026-07-20 16:05:17 +00:00
let product = null;
2026-07-29 08:29:29 +00:00
if (null != noop) {
product = outer1_6.getProduct(tmp);
2026-07-20 16:05:17 +00:00
}
return product;
}, items4);
2026-07-29 08:29:29 +00:00
const formatPriceResult = formatPrice(amount[5]);
let isIOSResult = formatPrice(amount[10]).isIOS();
2026-07-20 16:05:17 +00:00
if (isIOSResult) {
if (!enabled) {
let isACOM;
2026-07-29 08:29:29 +00:00
if (stateFromStores != tmp5) {
2026-07-20 16:05:17 +00:00
isACOM = stateFromStores.isACOM;
}
enabled = true === isACOM;
}
isIOSResult = enabled;
}
2026-07-29 08:29:29 +00:00
addSubscriptionPlan = isIOSResult;
const tmp10 = tmp2(amount[11])(() => new storeFront(priceState[12])(500, 10000));
reset = tmp10;
const items5 = [isIOSResult, priceState, storeFront, tmp10];
2026-07-20 16:05:17 +00:00
const effect = React.useEffect(() => {
2026-07-29 08:29:29 +00:00
if (addSubscriptionPlan) {
2026-07-23 10:11:24 +00:00
if (priceState !== callback(priceState[8]).PriceStates.PRICE_AVAILABLE) {
2026-07-29 08:29:29 +00:00
if (tmp === tmp2(tmp3[8]).PriceStates.MISMATCHING_COUNTRIES) {
2026-07-20 16:05:17 +00:00
let country;
2026-07-29 08:29:29 +00:00
if (storeFront != null) {
country = tmp6.country;
2026-07-20 16:05:17 +00:00
}
if (null != country) {
2026-07-29 08:29:29 +00:00
if (!tmp10.pending) {
2026-07-20 16:05:17 +00:00
if (!isIOSResult.isFetchingForPremiumSKUs()) {
2026-07-29 08:29:29 +00:00
if (obj.fails < 3) {
country = tmp6.country;
obj.fail(() => {
2026-07-23 10:11:24 +00:00
if (!isIOSResult.isFetchingForPremiumSKUs()) {
const obj = country(priceState[13]);
const premiumSubscriptionPlans = obj.fetchPremiumSubscriptionPlans(country, undefined, undefined, outer2_7.APPLE_ADVANCED_COMMERCE);
2026-07-20 16:05:17 +00:00
premiumSubscriptionPlans.catch(() => {
});
}
});
return () => {
2026-07-29 08:29:29 +00:00
reset.cancel();
2026-07-20 16:05:17 +00:00
};
}
}
}
}
}
} else {
2026-07-29 08:29:29 +00:00
tmp10.succeed();
2026-07-20 16:05:17 +00:00
}
}
}, items5);
2026-07-29 08:29:29 +00:00
if (tmp5 == arg0) {
2026-07-20 16:05:17 +00:00
return null;
} else if (isIOSResult) {
2026-07-29 08:29:29 +00:00
let tmp14 = null;
if (priceState === formatPrice(amount[8]).PriceStates.PRICE_AVAILABLE) {
tmp14 = null;
if (tmp5 != price) {
obj = { price: null, currency: null, countryCode: null, priceString: null, source: "API" };
({ amount: obj7[0], currency: obj7[1] } = price);
tmp5 = storeFront == tmp5;
2026-07-20 16:05:17 +00:00
let country;
2026-07-29 08:29:29 +00:00
if (!tmp5) {
2026-07-20 16:05:17 +00:00
country = storeFront.country;
}
2026-07-29 08:29:29 +00:00
obj[2] = country;
priceState = formatPrice(amount[14]);
formatPrice = priceState.formatPrice;
amount = price.amount;
price = formatPrice(amount, price.currency);
obj[3] = price;
tmp14 = obj;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
let tmp12 = tmp14;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp12 = null;
if (tmp5 != stateFromStores2) {
obj = { price: null, currency: null, countryCode: null, priceString: null, source: "IAP" };
({ price: obj6[0], currencyCode: obj6[1] } = stateFromStores2);
2026-07-20 16:05:17 +00:00
let country1;
2026-07-29 08:29:29 +00:00
if (storeFront != tmp5) {
2026-07-20 16:05:17 +00:00
country1 = storeFront.country;
}
2026-07-29 08:29:29 +00:00
if (country1 == tmp5) {
2026-07-20 16:05:17 +00:00
country1 = stateFromStores2.countryCode;
}
2026-07-29 08:29:29 +00:00
obj[2] = country1;
obj[3] = stateFromStores2.priceString;
tmp12 = obj;
2026-07-20 16:05:17 +00:00
}
}
};