2023-10-18 13:47:45 +00:00
|
|
|
import { FormattedMessage } from "react-intl";
|
|
|
|
import { MetadataCache } from "@snort/system";
|
|
|
|
|
2024-01-04 13:48:19 +00:00
|
|
|
import { BaseUITask } from "@/Components/Tasks/index";
|
|
|
|
import { LoginSession } from "@/Utils/Login";
|
|
|
|
import { getCurrentSubscription } from "@/Utils/Subscription";
|
2023-11-17 11:52:10 +00:00
|
|
|
import { RenewSub } from "@/Pages/subscribe/RenewSub";
|
2023-10-18 13:47:45 +00:00
|
|
|
|
|
|
|
export class RenewSubTask extends BaseUITask {
|
|
|
|
id = "renew-sub";
|
|
|
|
|
|
|
|
check(user: MetadataCache, session: LoginSession): boolean {
|
|
|
|
const sub = getCurrentSubscription(session.subscriptions);
|
|
|
|
return !sub && session.subscriptions.length > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
render(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<p>
|
|
|
|
<FormattedMessage
|
2023-11-20 19:16:47 +00:00
|
|
|
defaultMessage="Your {site_name} subscription is expired"
|
|
|
|
id="jAmfGl"
|
2023-10-18 13:47:45 +00:00
|
|
|
values={{
|
|
|
|
site_name: CONFIG.appName,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</p>
|
|
|
|
<RenewSub />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|