decord/source/modules/guild_role_subscriptions/useTrialIntervalOptions.tsx

60 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 14676
// Function ID: 14677
2026-07-20 16:05:17 +00:00
// Name: useTrialIntervalOptions
2026-08-25 06:04:03 +00:00
// Dependencies: [19, 14649, 1924, 1236, 14675, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-25 06:04:03 +00:00
// Module 14676 (useTrialIntervalOptions)
2026-08-24 06:08:38 +00:00
import closure_2 from "noop" /* 19 */;
2026-08-25 06:04:03 +00:00
import { TIER_TRIAL_INTERVALS } from "MAX_SUBSCRIPTION_TIERS" /* 14649 */;
2026-08-24 06:08:38 +00:00
import { SubscriptionIntervalTypes } from "GuildFeatures" /* 1924 */;
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/guild_role_subscriptions/useTrialIntervalOptions.tsx");
2026-07-20 16:05:17 +00:00
export default function useTrialIntervalOptions(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const items = [arg0];
return React.useMemo(() => {
2026-08-24 06:08:38 +00:00
const options = closure_1_3.map((interval) => {
2026-07-29 08:29:29 +00:00
let obj = { value: interval, label: null, isDefault: null };
if (interval.interval === constants.DAY) {
2026-07-20 16:05:17 +00:00
if (7 === interval.interval_count) {
2026-07-29 08:29:29 +00:00
const intl = lib(1236).intl;
obj = { defaultLimit: null };
2026-08-25 06:04:03 +00:00
obj[0] = lib(14675).formatPlanIntervalDuration(interval);
2026-07-29 08:29:29 +00:00
let formatToPlainStringResult = intl.formatToPlainString(lib(1236).t.XfSsr1, obj);
2026-08-25 06:04:03 +00:00
const obj4 = lib(14675);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = formatToPlainStringResult;
let tmp5 = interval.interval === tmp.DAY;
2026-07-20 16:05:17 +00:00
if (tmp5) {
tmp5 = 7 === interval.interval_count;
}
2026-07-29 08:29:29 +00:00
obj[2] = tmp5;
2026-07-20 16:05:17 +00:00
return obj;
}
2026-08-25 06:04:03 +00:00
formatToPlainStringResult = lib(14675).formatPlanIntervalDuration(interval);
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
let selectedOption = closure_0;
2026-07-23 10:11:24 +00:00
if (null != closure_0) {
2026-07-29 08:29:29 +00:00
const iter = options.find((value) => {
2026-07-20 16:05:17 +00:00
let tmp = null != value.value;
if (tmp) {
2026-07-29 08:29:29 +00:00
tmp = value.value.interval === lib.interval;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
2026-07-29 08:29:29 +00:00
tmp = value.value.interval_count === lib.interval_count;
2026-07-20 16:05:17 +00:00
}
return tmp;
});
let value;
2026-07-29 08:29:29 +00:00
if (iter != null) {
2026-07-20 16:05:17 +00:00
value = iter.value;
}
2026-07-29 08:29:29 +00:00
selectedOption = value;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return { options, selectedOption };
2026-07-20 16:05:17 +00:00
}, items);
};