decord/source/modules/guild_role_subscriptions/useActiveGuildSubscriptions.tsx

69 lines
2.1 KiB
TypeScript
Raw Normal View History

// Module ID: 15292
// Function ID: 15293
2026-07-20 16:05:17 +00:00
// Name: useActiveGuildSubscriptions
// Dependencies: [19, 4268, 15286, 15287, 504, 4929, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 15292 (useActiveGuildSubscriptions)
import actions_BillingActionCreatorsAll from "actions/BillingActionCreators" /* 4929 */;
import useUserRoleSubscriptionRelationshipDefault from "useUserRoleSubscriptionRelationship" /* 15287 */;
import noop from "module_19" /* 19 */;
import SubscriptionStore from "SubscriptionStore" /* 4268 */;
2026-07-23 10:11:24 +00:00
const require = fn;
const constants = fn(15286).UserGuildRoleSubscriptionRelationship;
2026-07-20 16:05:17 +00:00
let closure_7 = [];
const size = fn(2);
const result = size.fileFinishedImporting("modules/guild_role_subscriptions/useActiveGuildSubscriptions.tsx");
2026-07-20 16:05:17 +00:00
export default function useActiveGuildSubscriptions() {
let obj = arg0;
if (arg0 === undefined) {
obj = {};
}
let flag = obj.ensureFresh;
if (flag === undefined) {
flag = false;
}
2026-08-24 06:08:38 +00:00
const tmp = useUserRoleSubscriptionRelationshipDefault() === constants.SUBSCRIBED;
2026-07-20 16:05:17 +00:00
importDefault = tmp;
const items = [SubscriptionStore];
let stateFromStores = flag(504).useStateFromStores(items, () => activeGuildSubscriptions.getActiveGuildSubscriptions());
noop.useRef(false);
2026-07-20 16:05:17 +00:00
const items1 = [flag, tmp];
const effect = noop.useEffect(() => {
2026-07-29 08:29:29 +00:00
const current = ref.current;
activeGuildSubscriptions = SubscriptionStore.getActiveGuildSubscriptions();
2026-07-29 08:29:29 +00:00
let num;
if (activeGuildSubscriptions != null) {
num = activeGuildSubscriptions.length;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp5 = !tmp4;
2026-08-24 06:08:38 +00:00
if (0 !== num || !closure_1) {
2026-07-29 08:29:29 +00:00
let tmp6 = !tmp;
if (tmp) {
tmp6 = current;
}
tmp5 = !tmp6;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp5) {
let tmp7 = !current;
if (!current) {
tmp7 = !SubscriptionStore.hasFetchedSubscriptions();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp5 = tmp7;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp5) {
2026-07-20 16:05:17 +00:00
ref.current = true;
const subscriptions = actions_BillingActionCreatorsAll.fetchSubscriptions();
2026-07-20 16:05:17 +00:00
}
}, items1);
2026-07-29 08:29:29 +00:00
if (stateFromStores == null) {
2026-07-20 16:05:17 +00:00
stateFromStores = closure_7;
}
return stateFromStores;
};