add trial expiry day countdown to billing banner

This commit is contained in:
Gregor Vostrak
2024-09-09 18:46:20 +02:00
committed by Constantin Graf
parent d211e962f5
commit 845f0d19d8
2 changed files with 21 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import { usePage } from '@inertiajs/vue3';
import { getDayJsInstance } from '@/packages/ui/src/utils/time';
export function isBillingActivated() {
const page = usePage<{
@@ -17,6 +18,22 @@ export function isInTrial() {
return page.props.billing.has_trial;
}
export function daysLeftInTrial() {
const page = usePage<{
billing: {
trial_until: string;
};
}>();
return (
getDayJsInstance()(page.props.billing.trial_until).diff(
getDayJsInstance()(),
'days'
) + 1
);
}
export function isBlocked() {
const page = usePage<{
billing: {