fix pluggin bug 2

This commit is contained in:
2026-09-09 20:19:01 +03:30
parent 08f648457f
commit bd12337f6e
2 changed files with 37 additions and 15 deletions
+12 -2
View File
@@ -1,4 +1,4 @@
export const PLUGIN_STORE_DURATIONS = [30, 90, 180, 360] as const;
export const PLUGIN_STORE_DURATIONS = [30, 90, 180, 360, 0] as const;
export type PluginStoreDuration = (typeof PLUGIN_STORE_DURATIONS)[number];
@@ -90,13 +90,23 @@ export const PLUGIN_CATALOG_SEED: Array<{
},
];
export function daysToPlanMonths(days: number): 1 | 3 | 6 | 12 {
export function daysToPlanMonths(days: number): 0 | 1 | 3 | 6 | 12 {
if (days === 0) return 0;
if (days === 90) return 3;
if (days === 180) return 6;
if (days === 360) return 12;
return 1;
}
export function pluginStoreDurationLabel(days: number): string {
if (Number(days) === 0) return 'یکبار پرداخت';
if (days === 30) return '۳۰ روزه';
if (days === 90) return '۹۰ روزه';
if (days === 180) return '۱۸۰ روزه';
if (days === 360) return '۳۶۰ روزه';
return `${days} روزه`;
}
export function inferSettingKeyFromName(name: string): string | null {
const n = String(name || '').trim();
if (!n) return null;