33 lines
1.6 KiB
TypeScript
33 lines
1.6 KiB
TypeScript
// Metro module 12447 (f12448).
|
|
import PaymentSourceStore from "../../../stores/billing/PaymentSourceStore";
|
|
import SubscriptionPlanStore from "../../../stores/billing/SubscriptionPlanStore";
|
|
import SubscriptionStore from "../../../stores/billing/SubscriptionStore";
|
|
import { ACTIVE_PREMIUM_SKUS } from "../../premium/PremiumConstants";
|
|
import Logger from "../../debug/Logger";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
const getSubscriptionPlansLoaded = function getSubscriptionPlansLoaded(r5 = [...ACTIVE_PREMIUM_SKUS], r26 = [PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore]) {
|
|
const [r36, r37, r40] = r26;
|
|
const { paymentSourceIds, defaultPaymentSourceId } = r36;
|
|
const isLoadedForSKUs = r37.isLoadedForSKUs(r5);
|
|
const paymentSourceId = r40.getPremiumTypeSubscription()?.paymentSourceId;
|
|
if (paymentSourceId != null && !r37.hasPaymentSourceForSKUIds(paymentSourceId, r5)) {
|
|
return false;
|
|
}
|
|
if (defaultPaymentSourceId != null && !r37.hasPaymentSourceForSKUIds(defaultPaymentSourceId, r5)) {
|
|
return false;
|
|
}
|
|
for (const item of paymentSourceIds) {
|
|
if (r37.hasPaymentSourceForSKUIds(item, r5)) {
|
|
continue;
|
|
}
|
|
return false;
|
|
}
|
|
return isLoadedForSKUs;
|
|
};
|
|
new Logger("useSubscriptionPlansLoaded");
|
|
export function useSubscriptionPlansLoaded(r7 = [...ACTIVE_PREMIUM_SKUS]) {
|
|
let c19850_0 = r7;
|
|
return useStateFromStores([PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore], () => getSubscriptionPlansLoaded(c19850_0, [PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore]), [r7]);
|
|
}
|
|
export { getSubscriptionPlansLoaded };
|