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

149 lines
5.1 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 7973
// Function ID: 7974
2026-07-20 16:05:17 +00:00
// Name: usePremiumPlanPrice
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 4047, 4048, 5324, 505, 589, 7734, 7974, 7975, 5327, 500, 7165, 584, 7261, 5321, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 7973 (usePremiumPlanPrice)
import closure_3 from "noop" /* 19 */;
import closure_4 from "addSubscriptionPlan" /* 4047 */;
import closure_5 from "reset" /* 4048 */;
import closure_6 from "updateProduct" /* 5324 */;
import { PaymentGateways } from "sum" /* 505 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/premium/native/hooks/usePremiumPlanPrice.tsx");
2026-07-20 16:05:17 +00:00
export default function usePremiumPlanPrice(arg0) {
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-08-24 06:08:38 +00:00
const items = [closure_5];
const stateFromStores = obj.useStateFromStores(items, () => closure_5.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;
2026-08-24 06:08:38 +00:00
const items1 = [closure_4];
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-08-24 06:08:38 +00:00
const items3 = [closure_6];
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-08-24 06:08:38 +00:00
if (null != closure_3) {
product = closure_1_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-08-24 06:08:38 +00:00
closure_4 = isIOSResult;
2026-07-29 08:29:29 +00:00
const tmp10 = tmp2(amount[11])(() => new storeFront(priceState[12])(500, 10000));
2026-08-24 06:08:38 +00:00
closure_5 = tmp10;
2026-07-29 08:29:29 +00:00
const items5 = [isIOSResult, priceState, storeFront, tmp10];
2026-07-20 16:05:17 +00:00
const effect = React.useEffect(() => {
2026-08-24 06:08:38 +00:00
if (closure_4) {
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-08-24 06:08:38 +00:00
if (!closure_5.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]);
2026-08-24 06:08:38 +00:00
const premiumSubscriptionPlans = obj.fetchPremiumSubscriptionPlans(country, undefined, undefined, closure_2_7.APPLE_ADVANCED_COMMERCE);
2026-07-20 16:05:17 +00:00
premiumSubscriptionPlans.catch(() => {
});
}
});
return () => {
2026-08-24 06:08:38 +00:00
closure_5.cancel();
2026-07-20 16:05:17 +00:00
};
}
}
}
}
}
} else {
2026-08-24 06:08:38 +00:00
closure_5.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
}
}
};