Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Don't allow changing plan during trial

Blue Mousebd4aa5ecb851
diff --git a/web/app/components/pricing/BillingPricing.tsx b/web/app/components/pricing/BillingPricing.tsx
index 5298948a2..54170c4f0 100644
--- a/web/app/components/pricing/BillingPricing.tsx
+++ b/web/app/components/pricing/BillingPricing.tsx
@@ -195,6 +195,11 @@ const BillingPricing = ({
!user.cancellationEffectiveDate &&
user.planCode !== 'none'
) {
+ if (isTrialingPaidPlan) {
+ toast.error(t('billing.cannotChangePlanDuringTrial'))
+ return
+ }
+
const planId = Number(
billingFrequency === BillingFrequency.monthly ? tier.pid : tier.ypid,
)
@@ -239,6 +244,12 @@ const BillingPricing = ({
const downgradeHandler = (tier: any) => {
if (!user) return
+
+ if (isTrialingPaidPlan) {
+ toast.error(t('billing.cannotChangePlanDuringTrial'))
+ return
+ }
+
if (planCodeLoading === null && user.planCode !== tier.planCode) {
setDowngradeTo(tier)
setShowDowngradeModal(true)
@@ -249,6 +260,11 @@ const BillingPricing = ({
return ['free', 'trial', 'none'].includes(planCode)
}
+ const isTrialingPaidPlan =
+ !!user?.trialEndDate &&
+ !['none', 'trial', 'free'].includes(user?.planCode || '') &&
+ dayjs(user.trialEndDate).isAfter(dayjs())
+
const userPlancodeID = user?.planCode ? PLAN_LIMITS[user.planCode]?.index : 0
const getActionLabel = (tier: any): string => {
diff --git a/web/public/locales/de.json b/web/public/locales/de.json
index f64f6d75c..dba10bbbc 100644
--- a/web/public/locales/de.json
+++ b/web/public/locales/de.json
@@ -2048,6 +2048,7 @@
"membersNotification": "Seitenaufrufe, benutzerdefinierte Ereignisse und Fehlerereignisse werden auf das Abonnementlimit des Kontoinhabers angerechnet. Personen, die Sie in Ihre Projekte einladen, benötigen kein Abonnement.",
"trialDescription": "Ihre kostenlose Testversion umfasst den Zugriff auf alle Funktionen und keine Limits bei der Datenerfassung. Wenn Ihre Testphase endet, müssen Sie einen kostenpflichtigen Tarif wählen, der Ihrer Nutzung entspricht, um Swetrix weiter verwenden zu können.",
"trialChargeWarning": "Ihnen wird der Betrag nach Ablauf der Testphase automatisch in Rechnung gestellt, sofern Sie nicht kündigen. Sie können jederzeit von dieser Seite aus kündigen — ohne Rückfragen.",
+ "cannotChangePlanDuringTrial": "Tarifänderungen sind während Ihrer Testphase nicht verfügbar. Sie können den Tarif nach Ablauf Ihrer Testphase wechseln oder Ihre Testphase abbrechen und einen anderen Tarif abonnieren.",
"subscriptionCancelledSuccess": "Ihr Abonnement wurde gekündigt. Sie behalten den Zugriff bis zum Ende Ihres aktuellen Abrechnungszeitraums.",
"confirmCancellation": "Abonnement kündigen",
"cancellationFeedbackLabel": "Wir würden gerne wissen, warum Sie gehen (optional)",
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index f2ca4eb2f..d0c9c0c45 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -2048,6 +2048,7 @@
"membersNotification": "Pageviews, custom events and error events are counted towards the limit of the subscription of the account owner. People you invite into your projects don't need a subscription.",
"trialDescription": "Your free trial includes access to all features and unlimited data collection limits. When your trial ends, you'll need to select a paid plan that matches your usage to continue using Swetrix.",
"trialChargeWarning": "You will be automatically charged when the trial ends unless you cancel. You can cancel anytime from this page — no questions asked.",
+ "cannotChangePlanDuringTrial": "Plan changes are not available during your trial. You can switch plans after your trial ends, or cancel your trial and subscribe to a different plan.",
"subscriptionCancelledSuccess": "Your subscription has been cancelled. You'll retain access until the end of your current billing period.",
"confirmCancellation": "Cancel subscription",
"cancellationFeedbackLabel": "We'd love to know why you're leaving (optional)",
diff --git a/web/public/locales/fr.json b/web/public/locales/fr.json
index c41d4c8f1..75b06e655 100644
--- a/web/public/locales/fr.json
+++ b/web/public/locales/fr.json
@@ -2048,6 +2048,7 @@
"membersNotification": "Les pages vues, les événements personnalisés et les erreurs sont décomptés du quota de l’abonnement du propriétaire du compte. Les personnes que vous invitez dans vos projets n’ont pas besoin d’un abonnement.",
"trialDescription": "Votre essai gratuit inclut l’accès à toutes les fonctionnalités et aucune limite de collecte de données. À la fin de votre essai, vous devrez choisir une offre payante adaptée à votre usage pour continuer à utiliser Swetrix.",
"trialChargeWarning": "Vous serez automatiquement facturé(e) à la fin de l'essai, sauf si vous annulez. Vous pouvez annuler à tout moment depuis cette page — sans justification.",
+ "cannotChangePlanDuringTrial": "Les changements de forfait ne sont pas disponibles pendant votre période d'essai. Vous pouvez changer de forfait après la fin de votre essai, ou annuler votre essai et vous abonner à un autre forfait.",
"subscriptionCancelledSuccess": "Votre abonnement a été annulé. Vous conserverez l'accès jusqu'à la fin de votre période de facturation en cours.",
"confirmCancellation": "Annuler l'abonnement",
"cancellationFeedbackLabel": "Nous aimerions savoir pourquoi vous nous quittez (facultatif)",
diff --git a/web/public/locales/pl.json b/web/public/locales/pl.json
index ce2a08aa4..858217348 100644
--- a/web/public/locales/pl.json
+++ b/web/public/locales/pl.json
@@ -2048,6 +2048,7 @@
"membersNotification": "Odsłony stron, zdarzenia niestandardowe i zdarzenia błędów są wliczane do limitu subskrypcji właściciela konta. Osoby, które zapraszasz do swoich projektów, nie potrzebują subskrypcji.",
"trialDescription": "Twój bezpłatny okres próbny obejmuje dostęp do wszystkich funkcji oraz brak limitów zbierania danych. Po zakończeniu okresu próbnego musisz wybrać płatny plan dopasowany do Twojego użycia, aby dalej korzystać ze Swetrix.",
"trialChargeWarning": "Po zakończeniu okresu próbnego zostaniesz automatycznie obciążony opłatą, chyba że anulujesz subskrypcję. Możesz ją anulować w dowolnym momencie z tej strony — bez zadawania pytań.",
+ "cannotChangePlanDuringTrial": "Zmiany planu nie są dostępne podczas okresu próbnego. Możesz zmienić plan po zakończeniu okresu próbnego lub anulować okres próbny i zasubskrybować inny plan.",
"subscriptionCancelledSuccess": "Twoja subskrypcja została anulowana. Zachowasz dostęp do końca bieżącego okresu rozliczeniowego.",
"confirmCancellation": "Anuluj subskrypcję",
"cancellationFeedbackLabel": "Chcielibyśmy wiedzieć, dlaczego odchodzisz (opcjonalnie)",
diff --git a/web/public/locales/uk.json b/web/public/locales/uk.json
index 67002edab..1efe02a4b 100644
--- a/web/public/locales/uk.json
+++ b/web/public/locales/uk.json
@@ -2048,6 +2048,7 @@
"membersNotification": "Перегляди сторінок, користувацькі події та події помилок зараховуються до ліміту підписки власника облікового запису. Людям, яких ви запрошуєте до своїх проєктів, підписка не потрібна.",
"trialDescription": "Ваша безкоштовна пробна версія надає доступ до всіх функцій і необмежені ліміти збору даних. Після завершення пробного періоду вам потрібно буде обрати платний тариф, який відповідає вашому рівню використання, щоб і надалі користуватися Swetrix.",
"trialChargeWarning": "З вас буде автоматично списано кошти після завершення пробного періоду, якщо ви його не скасуєте. Ви можете скасувати підписку в будь-який час на цій сторінці — без зайвих питань.",
+ "cannotChangePlanDuringTrial": "Зміна тарифного плану недоступна під час пробного періоду. Ви можете змінити тарифний план після закінчення пробного періоду або скасувати пробний період і підписатися на інший тарифний план.",
"subscriptionCancelledSuccess": "Вашу підписку скасовано. Ви матимете доступ до кінця поточного розрахункового періоду.",
"confirmCancellation": "Скасувати підписку",
"cancellationFeedbackLabel": "Ми хотіли б знати, чому ви йдете (необов'язково)",