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

154 lines
5.1 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 6514
2026-07-27 11:26:19 +00:00
// Function ID: 58231
2026-07-20 16:05:17 +00:00
// Name: usePremiumPlanPrice
2026-07-25 08:10:48 +00:00
// Dependencies: [31, 3782, 3783, 5619, 482, 566, 6445, 6515, 6516, 5622, 477, 5450, 561, 6244, 5616, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-25 08:10:48 +00:00
// Module 6514 (usePremiumPlanPrice)
2026-07-23 10:11:24 +00:00
import result from "result";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
import closure_6 from "_isNativeReflectConstruct";
import { PaymentGateways } from "sum";
const require = arg1;
const result = require("_isNativeReflectConstruct").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-20 16:05:17 +00:00
let tmp;
2026-07-23 10:11:24 +00:00
let obj = _require(priceState[5]);
2026-07-20 16:05:17 +00:00
const items = [closure_5];
const stateFromStores = obj.useStateFromStores(items, () => tmp12.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]);
const items1 = [isIOSResult];
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) {
value = isIOSResult.get(closure_0);
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-20 16:05:17 +00:00
let formatPrice = null;
let tmp6 = null;
if (null != arg0) {
2026-07-23 10:11:24 +00:00
tmp6 = _require(priceState[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-20 16:05:17 +00:00
const items3 = [closure_6];
const items4 = [tmp6];
2026-07-23 10:11:24 +00:00
const stateFromStores2 = _require(priceState[5]).useStateFromStores(items3, () => {
2026-07-20 16:05:17 +00:00
let product = null;
2026-07-23 10:11:24 +00:00
if (null != result) {
product = outer1_6.getProduct(result);
2026-07-20 16:05:17 +00:00
}
return product;
}, items4);
2026-07-23 10:11:24 +00:00
const obj4 = _require(priceState[5]);
isIOSResult = _require(priceState[10]).isIOS();
2026-07-20 16:05:17 +00:00
if (isIOSResult) {
if (!enabled) {
let isACOM;
if (formatPrice != stateFromStores) {
isACOM = stateFromStores.isACOM;
}
enabled = true === isACOM;
}
isIOSResult = enabled;
}
2026-07-23 10:11:24 +00:00
const tmp12 = storeFront(priceState[11])(() => {
2026-07-20 16:05:17 +00:00
let tmp = storeFront(priceState[12]);
tmp = new tmp(500, 10000);
return tmp;
});
closure_5 = tmp12;
const items5 = [isIOSResult, priceState, storeFront, tmp12];
const effect = React.useEffect(() => {
2026-07-23 10:11:24 +00:00
if (_isNativeReflectConstruct) {
if (priceState !== callback(priceState[8]).PriceStates.PRICE_AVAILABLE) {
if (priceState === callback(priceState[8]).PriceStates.MISMATCHING_COUNTRIES) {
2026-07-20 16:05:17 +00:00
let country;
if (null != storeFront) {
country = storeFront.country;
}
if (null != country) {
if (!tmp12.pending) {
if (!isIOSResult.isFetchingForPremiumSKUs()) {
if (tmp12.fails < 3) {
2026-07-23 10:11:24 +00:00
country = storeFront.country;
2026-07-20 16:05:17 +00:00
tmp12.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-23 10:11:24 +00:00
outer1_5.cancel();
2026-07-20 16:05:17 +00:00
};
}
}
}
}
}
} else {
tmp12.succeed();
}
}
}, items5);
if (formatPrice == arg0) {
return null;
} else if (isIOSResult) {
let tmp18 = null;
2026-07-23 10:11:24 +00:00
if (priceState === _require(priceState[8]).PriceStates.PRICE_AVAILABLE) {
2026-07-20 16:05:17 +00:00
tmp18 = null;
if (formatPrice != price) {
obj = {};
({ amount: obj7.price, currency: obj7.currency } = price);
priceState = formatPrice == storeFront;
let country;
if (!priceState) {
country = storeFront.country;
}
obj.countryCode = country;
2026-07-23 10:11:24 +00:00
storeFront = priceState;
tmp = _require(priceState[14]);
2026-07-20 16:05:17 +00:00
formatPrice = tmp.formatPrice;
obj.priceString = formatPrice(price.amount, price.currency);
price = "API";
obj.source = "API";
tmp18 = obj;
}
}
let tmp14 = tmp18;
} else {
tmp14 = null;
if (formatPrice != stateFromStores2) {
obj = {};
({ price: obj6.price, currencyCode: obj6.currency } = stateFromStores2);
let country1;
if (formatPrice != storeFront) {
country1 = storeFront.country;
}
if (formatPrice == country1) {
country1 = stateFromStores2.countryCode;
}
obj.countryCode = country1;
obj.priceString = stateFromStores2.priceString;
obj.source = "IAP";
tmp14 = obj;
}
}
};