decord/alpha/source/modules/billing/hooks/useSubscriptionPlansLoaded.tsx

83 lines
2.6 KiB
TypeScript
Raw Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 13668
// Function ID: 13669
// Name: useSubscriptionPlansLoaded
2026-10-10 08:08:14 +00:00
// Dependencies: [4772, 4774, 4775, 1392, 3, 504, 2]
2026-07-20 16:05:17 +00:00
// Exports: useSubscriptionPlansLoaded
2026-10-10 08:08:14 +00:00
// Module 13668 (useSubscriptionPlansLoaded)
import LoggerDefault from "Logger" /* 3 */;
2026-10-09 10:00:15 +00:00
import PremiumConstants from "PremiumConstants" /* 1392 */;
2026-10-10 08:08:14 +00:00
import PaymentSourceStore from "PaymentSourceStore" /* 4772 */;
import SubscriptionPlanStore from "SubscriptionPlanStore" /* 4774 */;
import SubscriptionStore from "SubscriptionStore" /* 4775 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
function getSubscriptionPlansLoaded(items, items2) {
2026-10-03 08:58:59 +00:00
let defaultPaymentSourceId;
let obj;
let obj2;
let paymentSourceIds;
let tmp10;
let tmp2 = items;
2026-07-29 08:29:29 +00:00
if (items === undefined) {
items = [];
2026-10-03 08:58:59 +00:00
HermesBuiltin.arraySpread(items, ACTIVE_PREMIUM_SKUS, 0);
tmp2 = items;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
let tmp6 = items2;
if (items2 === undefined) {
const items1 = [PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore];
2026-10-03 08:58:59 +00:00
tmp6 = items1;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
[tmp10, obj, obj2] = tmp6;
({ paymentSourceIds, defaultPaymentSourceId } = tmp10);
const isLoadedForSKUsResult = obj.isLoadedForSKUs(tmp2);
2026-07-20 16:05:17 +00:00
const premiumTypeSubscription = obj2.getPremiumTypeSubscription();
let paymentSourceId;
2026-07-29 08:29:29 +00:00
if (premiumTypeSubscription != null) {
2026-07-20 16:05:17 +00:00
paymentSourceId = premiumTypeSubscription.paymentSourceId;
}
if (null != paymentSourceId) {
2026-10-03 08:58:59 +00:00
if (!obj.hasPaymentSourceForSKUIds(paymentSourceId, tmp2)) {
2026-07-20 16:05:17 +00:00
return false;
}
}
if (null != defaultPaymentSourceId) {
2026-10-03 08:58:59 +00:00
if (!obj.hasPaymentSourceForSKUIds(defaultPaymentSourceId, tmp2)) {
2026-07-20 16:05:17 +00:00
return false;
}
}
2026-07-29 08:29:29 +00:00
for (const item10046 of paymentSourceIds) {
2026-10-03 08:58:59 +00:00
if (obj.hasPaymentSourceForSKUIds(item10046, tmp2)) {
2026-07-29 08:29:29 +00:00
continue;
} else {
obj3.return();
let flag3 = false;
return false;
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
return isLoadedForSKUsResult;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const ACTIVE_PREMIUM_SKUS = PremiumConstants.ACTIVE_PREMIUM_SKUS;
let tmp2 = new LoggerDefault("useSubscriptionPlansLoaded");
const result = size.fileFinishedImporting("modules/billing/hooks/useSubscriptionPlansLoaded.tsx");
2026-07-20 16:05:17 +00:00
export const useSubscriptionPlansLoaded = function useSubscriptionPlansLoaded() {
2026-10-03 08:58:59 +00:00
let items;
let tmp2 = arg0;
2026-07-20 16:05:17 +00:00
if (arg0 === undefined) {
2026-10-03 08:58:59 +00:00
items = [];
HermesBuiltin.arraySpread(items, ACTIVE_PREMIUM_SKUS, 0);
tmp2 = items;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
items = tmp2;
const items1 = [PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore];
2026-10-03 08:58:59 +00:00
const items2 = [tmp2];
const obj = items(504);
return obj.useStateFromStores(items1, () => {
items = [PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore];
return getSubscriptionPlansLoaded(items, items);
2026-07-20 16:05:17 +00:00
}, items2);
};
export { getSubscriptionPlansLoaded };