decord/source/modules/guild_role_subscriptions/useTrialIntervalOptions.tsx

60 lines
2 KiB
TypeScript
Raw Normal View History

// Module ID: 15313
// Function ID: 15314
2026-07-20 16:05:17 +00:00
// Name: useTrialIntervalOptions
// Dependencies: [19, 15286, 1373, 1114, 15312, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 15313 (useTrialIntervalOptions)
import noop from "module_19" /* 19 */;
2026-07-23 10:11:24 +00:00
const require = fn;
const TIER_TRIAL_INTERVALS = fn(15286).TIER_TRIAL_INTERVALS;
const SubscriptionIntervalTypes = fn(1373).SubscriptionIntervalTypes;
const size = fn(2);
const result = size.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 noop.useMemo(() => {
const options = TIER_TRIAL_INTERVALS.map((value) => {
const obj = { value, label: null, isDefault: null };
if (value.interval === constants.DAY) {
if (7 === value.interval_count) {
const intl = closure_1_0(1114).intl;
const obj3 = { defaultLimit: closure_1_0(15312).formatPlanIntervalDuration(value) };
let formatToPlainStringResult = intl.formatToPlainString(closure_1_0(1114).t.XfSsr1, obj3);
const obj4 = closure_1_0(15312);
2026-07-20 16:05:17 +00:00
}
obj.label = formatToPlainStringResult;
let tmp5 = value.interval === tmp.DAY;
2026-07-20 16:05:17 +00:00
if (tmp5) {
tmp5 = 7 === value.interval_count;
2026-07-20 16:05:17 +00:00
}
obj.isDefault = tmp5;
2026-07-20 16:05:17 +00:00
return obj;
}
formatToPlainStringResult = closure_1_0(15312).formatPlanIntervalDuration(value);
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) {
tmp = value.value.interval === closure_1_0.interval;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
tmp = value.value.interval_count === closure_1_0.interval_count;
2026-07-20 16:05:17 +00:00
}
return tmp;
});
value = undefined;
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);
};