Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Refactor subscription management to billing

Bill Yang78026923f9f5
diff --git a/client/messages/cs.json b/client/messages/cs.json
index 72c4c6895..abe45aba8 100644
--- a/client/messages/cs.json
+++ b/client/messages/cs.json
@@ -769,6 +769,12 @@
"hxZIZ2": "Tuto akci nelze vrátit zpět. Trvale se smaže tvůj účet a odstraní všechna tvá data z našich serverů.",
"NQgbYA": "Nastavení účtu",
"xrcdXO": "Spravuj nastavení svého osobního účtu",
+ "Tbo377": "",
+ "ZcBC7s": "",
+ "oemoXC": "",
+ "GH6rlO": "",
+ "JgKGg8": "",
+ "siqsij": "",
"cU/aSG": "",
"nY0P01": "",
"9tjZ7S": "",
@@ -841,11 +847,6 @@
"i7B/4+": "",
"Q5kEny": "",
"8g8bMC": "",
- "ZcBC7s": "",
- "oemoXC": "",
- "GH6rlO": "",
- "JgKGg8": "",
- "siqsij": "",
"L8DzHm": "",
"21Ef1P": "",
"EjE0iv": "",
diff --git a/client/messages/de.json b/client/messages/de.json
index 2512c621f..6768e317e 100644
--- a/client/messages/de.json
+++ b/client/messages/de.json
@@ -769,6 +769,12 @@
"hxZIZ2": "Diese Aktion kann nicht rückgängig gemacht werden. Ihr Konto und alle Daten werden dauerhaft von unseren Servern gelöscht.",
"NQgbYA": "Kontoeinstellungen",
"xrcdXO": "Verwalten Sie Ihre persönlichen Kontoeinstellungen",
+ "Tbo377": "",
+ "ZcBC7s": "Verwalten Sie Ihr Abonnement und Ihre Rechnungen.",
+ "oemoXC": "Sie haben keine Berechtigung, die Abonnementeinstellungen anzuzeigen.",
+ "GH6rlO": "Sie müssen eine Organisation auswählen, um Ihr Abonnement zu verwalten.",
+ "JgKGg8": "Kein Inhaber",
+ "siqsij": "Nur der Inhaber der Organisation kann das Abonnement verwalten.",
"cU/aSG": "E-Mail ist erforderlich",
"nY0P01": "Benutzer erfolgreich erstellt",
"9tjZ7S": "Benutzer konnte nicht erstellt werden",
@@ -841,11 +847,6 @@
"i7B/4+": "Diese Organisation und alle zugehörigen Daten dauerhaft löschen",
"Q5kEny": "Organisation wird geladen...",
"8g8bMC": "Sie müssen eine Organisation erstellen oder einer beitreten, bevor Sie Mitglieder verwalten können.",
- "ZcBC7s": "Verwalten Sie Ihr Abonnement und Ihre Rechnungen.",
- "oemoXC": "Sie haben keine Berechtigung, die Abonnementeinstellungen anzuzeigen.",
- "GH6rlO": "Sie müssen eine Organisation auswählen, um Ihr Abonnement zu verwalten.",
- "JgKGg8": "Kein Inhaber",
- "siqsij": "Nur der Inhaber der Organisation kann das Abonnement verwalten.",
"L8DzHm": "Teamname ist erforderlich",
"21Ef1P": "Team erfolgreich aktualisiert",
"EjE0iv": "Team erfolgreich erstellt",
diff --git a/client/messages/en.json b/client/messages/en.json
index 215e78cb1..29e7819d8 100644
--- a/client/messages/en.json
+++ b/client/messages/en.json
@@ -769,6 +769,12 @@
"hxZIZ2": "This action cannot be undone. This will permanently delete your account and remove all your data from our servers.",
"NQgbYA": "Account Settings",
"xrcdXO": "Manage your personal account settings",
+ "Tbo377": "Billing",
+ "ZcBC7s": "Manage your subscription and billing.",
+ "oemoXC": "You don't have permission to view subscription settings.",
+ "GH6rlO": "You need to select an organization to manage your subscription.",
+ "JgKGg8": "Not an owner",
+ "siqsij": "Only the owner of the organization can manage the subscription.",
"cU/aSG": "Email is required",
"nY0P01": "User created successfully",
"9tjZ7S": "Failed to create user",
@@ -841,11 +847,6 @@
"i7B/4+": "Permanently delete this organization and all its data",
"Q5kEny": "Loading organization...",
"8g8bMC": "You need to create or be added to an organization before you can manage members.",
- "ZcBC7s": "Manage your subscription and billing.",
- "oemoXC": "You don't have permission to view subscription settings.",
- "GH6rlO": "You need to select an organization to manage your subscription.",
- "JgKGg8": "Not an owner",
- "siqsij": "Only the owner of the organization can manage the subscription.",
"L8DzHm": "Team name is required",
"21Ef1P": "Team updated successfully",
"EjE0iv": "Team created successfully",
diff --git a/client/messages/es.json b/client/messages/es.json
index f39928397..00817499c 100644
--- a/client/messages/es.json
+++ b/client/messages/es.json
@@ -769,6 +769,12 @@
"hxZIZ2": "Esta acción no se puede deshacer. Se eliminará permanentemente tu cuenta y todos tus datos de nuestros servidores.",
"NQgbYA": "Configuración de la cuenta",
"xrcdXO": "Administra la configuración de tu cuenta personal",
+ "Tbo377": "",
+ "ZcBC7s": "Administra tu suscripción y facturación.",
+ "oemoXC": "No tienes permiso para ver la configuración de la suscripción.",
+ "GH6rlO": "Necesitas seleccionar una organización para gestionar tu suscripción.",
+ "JgKGg8": "No eres propietario",
+ "siqsij": "Solo el propietario de la organización puede gestionar la suscripción.",
"cU/aSG": "El correo electrónico es obligatorio",
"nY0P01": "Usuario creado correctamente",
"9tjZ7S": "Error al crear el usuario",
@@ -841,11 +847,6 @@
"i7B/4+": "Elimina permanentemente esta organización y todos sus datos",
"Q5kEny": "Cargando organización...",
"8g8bMC": "Necesitas crear o ser añadido a una organización antes de poder gestionar miembros.",
- "ZcBC7s": "Administra tu suscripción y facturación.",
- "oemoXC": "No tienes permiso para ver la configuración de la suscripción.",
- "GH6rlO": "Necesitas seleccionar una organización para gestionar tu suscripción.",
- "JgKGg8": "No eres propietario",
- "siqsij": "Solo el propietario de la organización puede gestionar la suscripción.",
"L8DzHm": "El nombre del equipo es obligatorio",
"21Ef1P": "Equipo actualizado correctamente",
"EjE0iv": "Equipo creado correctamente",
diff --git a/client/messages/fr.json b/client/messages/fr.json
index e9af7a888..ff85bf27d 100644
--- a/client/messages/fr.json
+++ b/client/messages/fr.json
@@ -769,6 +769,12 @@
"hxZIZ2": "Cette action est irréversible. Votre compte et toutes vos données seront définitivement supprimés de nos serveurs.",
"NQgbYA": "Paramètres du compte",
"xrcdXO": "Gérez vos paramètres personnels de compte",
+ "Tbo377": "",
+ "ZcBC7s": "Gérez votre abonnement et votre facturation.",
+ "oemoXC": "Vous n'avez pas l'autorisation de consulter les paramètres d'abonnement.",
+ "GH6rlO": "Vous devez sélectionner une organisation pour gérer votre abonnement.",
+ "JgKGg8": "Pas propriétaire",
+ "siqsij": "Seul le propriétaire de l'organisation peut gérer l'abonnement.",
"cU/aSG": "L'e-mail est requis",
"nY0P01": "Utilisateur créé avec succès",
"9tjZ7S": "Échec de la création de l'utilisateur",
@@ -841,11 +847,6 @@
"i7B/4+": "Supprimer définitivement cette organisation et toutes ses données",
"Q5kEny": "Chargement de l'organisation...",
"8g8bMC": "Vous devez créer ou rejoindre une organisation avant de pouvoir gérer les membres.",
- "ZcBC7s": "Gérez votre abonnement et votre facturation.",
- "oemoXC": "Vous n'avez pas l'autorisation de consulter les paramètres d'abonnement.",
- "GH6rlO": "Vous devez sélectionner une organisation pour gérer votre abonnement.",
- "JgKGg8": "Pas propriétaire",
- "siqsij": "Seul le propriétaire de l'organisation peut gérer l'abonnement.",
"L8DzHm": "Le nom de l'équipe est requis",
"21Ef1P": "Équipe mise à jour avec succès",
"EjE0iv": "Équipe créée avec succès",
diff --git a/client/messages/it.json b/client/messages/it.json
index d6e7af66c..d30763806 100644
--- a/client/messages/it.json
+++ b/client/messages/it.json
@@ -769,6 +769,12 @@
"hxZIZ2": "Questa azione non può essere annullata. Questo eliminerà permanentemente il tuo account e rimuoverà tutti i tuoi dati dai nostri server.",
"NQgbYA": "Impostazioni Account",
"xrcdXO": "Gestisci le impostazioni del tuo account personale",
+ "Tbo377": "",
+ "ZcBC7s": "Gestisci il tuo abbonamento e la fatturazione.",
+ "oemoXC": "Non hai il permesso di visualizzare le impostazioni dell'abbonamento.",
+ "GH6rlO": "Devi selezionare un'organizzazione per gestire il tuo abbonamento.",
+ "JgKGg8": "Non sei un proprietario",
+ "siqsij": "Solo il proprietario dell'organizzazione può gestire l'abbonamento.",
"cU/aSG": "L'email è obbligatoria",
"nY0P01": "Utente creato con successo",
"9tjZ7S": "Impossibile creare l'utente",
@@ -841,11 +847,6 @@
"i7B/4+": "Elimina permanentemente questa organizzazione e tutti i suoi dati",
"Q5kEny": "Caricamento organizzazione...",
"8g8bMC": "Devi creare o essere aggiunto a un'organizzazione prima di poter gestire i membri.",
- "ZcBC7s": "Gestisci il tuo abbonamento e la fatturazione.",
- "oemoXC": "Non hai il permesso di visualizzare le impostazioni dell'abbonamento.",
- "GH6rlO": "Devi selezionare un'organizzazione per gestire il tuo abbonamento.",
- "JgKGg8": "Non sei un proprietario",
- "siqsij": "Solo il proprietario dell'organizzazione può gestire l'abbonamento.",
"L8DzHm": "Il nome del team è obbligatorio",
"21Ef1P": "Team aggiornato con successo",
"EjE0iv": "Team creato con successo",
diff --git a/client/messages/ja.json b/client/messages/ja.json
index 9be5132a2..7c8772158 100644
--- a/client/messages/ja.json
+++ b/client/messages/ja.json
@@ -769,6 +769,12 @@
"hxZIZ2": "この操作は元に戻せません。アカウントとすべてのデータがサーバーから完全に削除されます。",
"NQgbYA": "アカウント設定",
"xrcdXO": "個人のアカウント設定を管理",
+ "Tbo377": "",
+ "ZcBC7s": "サブスクリプションと請求を管理する。",
+ "oemoXC": "サブスクリプション設定を表示する権限がありません。",
+ "GH6rlO": "サブスクリプションを管理するには組織を選択する必要があります。",
+ "JgKGg8": "オーナーではありません",
+ "siqsij": "サブスクリプションを管理できるのは組織のオーナーのみです。",
"cU/aSG": "メールアドレスは必須です",
"nY0P01": "ユーザーが正常に作成されました",
"9tjZ7S": "ユーザーの作成に失敗しました",
@@ -841,11 +847,6 @@
"i7B/4+": "この組織とすべてのデータを完全に削除",
"Q5kEny": "組織を読み込み中...",
"8g8bMC": "メンバーを管理する前に、組織を作成するか組織に追加される必要があります。",
- "ZcBC7s": "サブスクリプションと請求を管理する。",
- "oemoXC": "サブスクリプション設定を表示する権限がありません。",
- "GH6rlO": "サブスクリプションを管理するには組織を選択する必要があります。",
- "JgKGg8": "オーナーではありません",
- "siqsij": "サブスクリプションを管理できるのは組織のオーナーのみです。",
"L8DzHm": "チーム名は必須です",
"21Ef1P": "チームが正常に更新されました",
"EjE0iv": "チームが正常に作成されました",
diff --git a/client/messages/ko.json b/client/messages/ko.json
index 054d35c26..d23e6c125 100644
--- a/client/messages/ko.json
+++ b/client/messages/ko.json
@@ -769,6 +769,12 @@
"hxZIZ2": "이 작업은 취소할 수 없습니다. 계정이 영구적으로 삭제되고 서버에서 모든 데이터가 제거됩니다.",
"NQgbYA": "계정 설정",
"xrcdXO": "개인 계정 설정을 관리하세요",
+ "Tbo377": "",
+ "ZcBC7s": "구독 및 청구를 관리합니다.",
+ "oemoXC": "구독 설정을 볼 권한이 없습니다.",
+ "GH6rlO": "구독을 관리하려면 조직을 선택해야 합니다.",
+ "JgKGg8": "소유자가 아님",
+ "siqsij": "조직 소유자만 구독을 관리할 수 있습니다.",
"cU/aSG": "이메일이 필요합니다",
"nY0P01": "사용자가 성공적으로 생성되었습니다",
"9tjZ7S": "사용자 생성에 실패했습니다",
@@ -841,11 +847,6 @@
"i7B/4+": "이 조직과 모든 데이터를 영구적으로 삭제합니다",
"Q5kEny": "조직 로딩 중...",
"8g8bMC": "멤버를 관리하기 전에 조직을 만들거나 조직에 추가되어야 합니다.",
- "ZcBC7s": "구독 및 청구를 관리합니다.",
- "oemoXC": "구독 설정을 볼 권한이 없습니다.",
- "GH6rlO": "구독을 관리하려면 조직을 선택해야 합니다.",
- "JgKGg8": "소유자가 아님",
- "siqsij": "조직 소유자만 구독을 관리할 수 있습니다.",
"L8DzHm": "팀 이름이 필요합니다",
"21Ef1P": "팀이 성공적으로 업데이트되었습니다",
"EjE0iv": "팀이 성공적으로 생성되었습니다",
diff --git a/client/messages/pl.json b/client/messages/pl.json
index eb0217a44..f6ae978e1 100644
--- a/client/messages/pl.json
+++ b/client/messages/pl.json
@@ -769,6 +769,12 @@
"hxZIZ2": "Tej czynności nie można cofnąć. Spowoduje to trwałe usunięcie konta i usunięcie wszystkich danych z naszych serwerów.",
"NQgbYA": "Ustawienia konta",
"xrcdXO": "Zarządzaj osobistymi ustawieniami konta",
+ "Tbo377": "",
+ "ZcBC7s": "Zarządzaj subskrypcją i rozliczeniami.",
+ "oemoXC": "Nie masz uprawnień do wyświetlania ustawień subskrypcji.",
+ "GH6rlO": "Musisz wybrać organizację, aby zarządzać subskrypcją.",
+ "JgKGg8": "Nie jesteś właścicielem",
+ "siqsij": "Tylko właściciel organizacji może zarządzać subskrypcją.",
"cU/aSG": "E-mail jest wymagany",
"nY0P01": "Użytkownik został pomyślnie utworzony",
"9tjZ7S": "Nie udało się utworzyć użytkownika",
@@ -841,11 +847,6 @@
"i7B/4+": "Trwale usuń tę organizację i wszystkie jej dane",
"Q5kEny": "Ładowanie organizacji...",
"8g8bMC": "Musisz utworzyć lub zostać dodanym do organizacji, zanim będziesz mógł zarządzać członkami.",
- "ZcBC7s": "Zarządzaj subskrypcją i rozliczeniami.",
- "oemoXC": "Nie masz uprawnień do wyświetlania ustawień subskrypcji.",
- "GH6rlO": "Musisz wybrać organizację, aby zarządzać subskrypcją.",
- "JgKGg8": "Nie jesteś właścicielem",
- "siqsij": "Tylko właściciel organizacji może zarządzać subskrypcją.",
"L8DzHm": "Nazwa zespołu jest wymagana",
"21Ef1P": "Zespół został pomyślnie zaktualizowany",
"EjE0iv": "Zespół został pomyślnie utworzony",
diff --git a/client/messages/pt.json b/client/messages/pt.json
index 9553bea26..23ca25962 100644
--- a/client/messages/pt.json
+++ b/client/messages/pt.json
@@ -769,6 +769,12 @@
"hxZIZ2": "Esta ação não pode ser desfeita. Isso excluirá permanentemente sua conta e removerá todos os seus dados dos nossos servidores.",
"NQgbYA": "Configurações da Conta",
"xrcdXO": "Gerencie suas configurações pessoais de conta",
+ "Tbo377": "",
+ "ZcBC7s": "Gerencie sua assinatura e cobrança.",
+ "oemoXC": "Você não tem permissão para ver as configurações de assinatura.",
+ "GH6rlO": "Você precisa selecionar uma organização para gerenciar sua assinatura.",
+ "JgKGg8": "Não é proprietário",
+ "siqsij": "Apenas o proprietário da organização pode gerenciar a assinatura.",
"cU/aSG": "E-mail é obrigatório",
"nY0P01": "Usuário criado com sucesso",
"9tjZ7S": "Falha ao criar usuário",
@@ -841,11 +847,6 @@
"i7B/4+": "Excluir permanentemente esta organização e todos os seus dados",
"Q5kEny": "Carregando organização...",
"8g8bMC": "Você precisa criar ou ser adicionado a uma organização antes de gerenciar membros.",
- "ZcBC7s": "Gerencie sua assinatura e cobrança.",
- "oemoXC": "Você não tem permissão para ver as configurações de assinatura.",
- "GH6rlO": "Você precisa selecionar uma organização para gerenciar sua assinatura.",
- "JgKGg8": "Não é proprietário",
- "siqsij": "Apenas o proprietário da organização pode gerenciar a assinatura.",
"L8DzHm": "Nome do time é obrigatório",
"21Ef1P": "Time atualizado com sucesso",
"EjE0iv": "Time criado com sucesso",
diff --git a/client/messages/zh.json b/client/messages/zh.json
index 41a047522..30db83d04 100644
--- a/client/messages/zh.json
+++ b/client/messages/zh.json
@@ -769,6 +769,12 @@
"hxZIZ2": "此操作无法撤销。这将永久删除您的帐户,并从我们的服务器中删除您的所有数据。",
"NQgbYA": "帐户设置",
"xrcdXO": "管理您的个人帐户设置",
+ "Tbo377": "",
+ "ZcBC7s": "管理您的订阅和账单。",
+ "oemoXC": "您没有权限查看订阅设置。",
+ "GH6rlO": "您需要选择一个组织以管理您的订阅。",
+ "JgKGg8": "不是所有者",
+ "siqsij": "只有组织的所有者才能管理订阅。",
"cU/aSG": "需要电子邮件",
"nY0P01": "用户创建成功",
"9tjZ7S": "创建用户失败",
@@ -841,11 +847,6 @@
"i7B/4+": "永久删除此组织及其所有数据",
"Q5kEny": "正在加载组织...",
"8g8bMC": "您需要创建或被添加到某个组织,然后才能管理成员。",
- "ZcBC7s": "管理您的订阅和账单。",
- "oemoXC": "您没有权限查看订阅设置。",
- "GH6rlO": "您需要选择一个组织以管理您的订阅。",
- "JgKGg8": "不是所有者",
- "siqsij": "只有组织的所有者才能管理订阅。",
"L8DzHm": "团队名称不能为空",
"21Ef1P": "团队更新成功",
"EjE0iv": "团队创建成功",
diff --git a/client/src/app/[site]/components/Header/UsageBanners.tsx b/client/src/app/[site]/components/Header/UsageBanners.tsx
index 74c9c25a0..c7676e0b9 100644
--- a/client/src/app/[site]/components/Header/UsageBanners.tsx
+++ b/client/src/app/[site]/components/Header/UsageBanners.tsx
@@ -42,7 +42,7 @@ export function UsageBanners() {
</div>
{site.isOwner && (
<Button variant="success" size="sm" asChild>
- <Link href="/settings/subscription">
+ <Link href="/settings/billing">
{t("Upgrade")} <ArrowRight className="ml-1 h-3 w-3" />
</Link>
</Button>
@@ -67,7 +67,7 @@ export function UsageBanners() {
</div>
{site.isOwner && (
<Button variant="success" size="sm" asChild>
- <Link href="/settings/subscription">
+ <Link href="/settings/billing">
{t("Upgrade")} <ArrowRight className="ml-1 h-3 w-3" />
</Link>
</Button>
diff --git a/client/src/app/settings/subscription/layout.tsx b/client/src/app/settings/billing/layout.tsx
similarity index 84%
rename from client/src/app/settings/subscription/layout.tsx
rename to client/src/app/settings/billing/layout.tsx
index 67012347f..4348aba1c 100644
--- a/client/src/app/settings/subscription/layout.tsx
+++ b/client/src/app/settings/billing/layout.tsx
@@ -3,7 +3,7 @@
import { useExtracted } from "next-intl";
import { authClient } from "../../../lib/auth";
-export default function SubscriptionLayout({ children }: { children: React.ReactNode }) {
+export default function BillingLayout({ children }: { children: React.ReactNode }) {
const t = useExtracted();
const { data: session } = authClient.useSession();
const { data: activeOrg } = authClient.useActiveOrganization();
@@ -15,7 +15,7 @@ export default function SubscriptionLayout({ children }: { children: React.React
return (
<div className="space-y-5">
<div>
- <h1 className="text-3xl font-bold tracking-tight">{t("Subscription")}</h1>
+ <h1 className="text-3xl font-bold tracking-tight">{t("Billing")}</h1>
<p className="text-neutral-500 dark:text-neutral-400">
{t("Manage your subscription and billing.")}
</p>
diff --git a/client/src/app/settings/subscription/page.tsx b/client/src/app/settings/billing/page.tsx
similarity index 97%
rename from client/src/app/settings/subscription/page.tsx
rename to client/src/app/settings/billing/page.tsx
index ff44f1c6e..707467f59 100644
--- a/client/src/app/settings/subscription/page.tsx
+++ b/client/src/app/settings/billing/page.tsx
@@ -16,8 +16,8 @@ import { authClient } from "@/lib/auth";
import { useEffect } from "react";
import { AppSumoPlan } from "../../../components/subscription/AppSumoPlan";
-export default function OrganizationSubscriptionPage() {
- useSetPageTitle("Organization Subscription");
+export default function OrganizationBillingPage() {
+ useSetPageTitle("Organization Billing");
const t = useExtracted();
const { data: activeSubscription, isLoading: isLoadingSubscription } = useStripeSubscription();
diff --git a/client/src/app/subscribe/components/PricingCards.tsx b/client/src/app/subscribe/components/PricingCards.tsx
index bb3eda7eb..79082fcdd 100644
--- a/client/src/app/subscribe/components/PricingCards.tsx
+++ b/client/src/app/subscribe/components/PricingCards.tsx
@@ -78,7 +78,7 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {
const baseUrl = window.location.origin;
const returnUrl = siteId
? `${baseUrl}/${siteId}?session_id={CHECKOUT_SESSION_ID}`
- : `${baseUrl}/settings/subscription?session_id={CHECKOUT_SESSION_ID}`;
+ : `${baseUrl}/settings/billing?session_id={CHECKOUT_SESSION_ID}`;
const response = await fetch(`${BACKEND_URL}/stripe/create-checkout-session`, {
method: "POST",
@@ -128,7 +128,7 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {
const baseUrl = window.location.origin;
const returnUrl = siteId
? `${baseUrl}/${siteId}?session_id={CHECKOUT_SESSION_ID}`
- : `${baseUrl}/settings/subscription?session_id={CHECKOUT_SESSION_ID}`;
+ : `${baseUrl}/settings/billing?session_id={CHECKOUT_SESSION_ID}`;
const response = await fetch(`${BACKEND_URL}/stripe/create-checkout-session`, {
method: "POST",
diff --git a/client/src/app/subscribe/page.tsx b/client/src/app/subscribe/page.tsx
index 9676c217d..88dfde8db 100644
--- a/client/src/app/subscribe/page.tsx
+++ b/client/src/app/subscribe/page.tsx
@@ -21,7 +21,7 @@ function SubscribeContent() {
// Redirect if already subscribed
// if (subscription?.status === "active" || subscription?.status === "trialing") {
- // router.push("/settings/subscription");
+ // router.push("/settings/billing");
// }
// Get the active organization ID
diff --git a/client/src/components/sidebar/NavigationSidebar.tsx b/client/src/components/sidebar/NavigationSidebar.tsx
index ee3973313..4e93e4d78 100644
--- a/client/src/components/sidebar/NavigationSidebar.tsx
+++ b/client/src/components/sidebar/NavigationSidebar.tsx
@@ -54,9 +54,9 @@ export function NavigationSidebar() {
/>
{IS_CLOUD && (
<Sidebar.Item
- label={t("Subscription")}
- active={pathname.startsWith("/settings/subscription")}
- href="/settings/subscription"
+ label={t("Billing")}
+ active={pathname.startsWith("/settings/billing")}
+ href="/settings/billing"
icon={<CreditCard className="w-4 h-4" />}
/>
)}
diff --git a/client/src/components/subscription/components/PlanDialog.tsx b/client/src/components/subscription/components/PlanDialog.tsx
index 5820097e1..1d615adb9 100644
--- a/client/src/components/subscription/components/PlanDialog.tsx
+++ b/client/src/components/subscription/components/PlanDialog.tsx
@@ -97,7 +97,7 @@ export function PlanDialog({ open, onOpenChange, currentPlanName, hasActiveSubsc
});
setShowProrationDialog(true);
} else {
- const returnUrl = `${baseUrl}/settings/subscription?session_id={CHECKOUT_SESSION_ID}`;
+ const returnUrl = `${baseUrl}/settings/billing?session_id={CHECKOUT_SESSION_ID}`;
const response = await fetch(`${BACKEND_URL}/stripe/create-checkout-session`, {
method: "POST",
diff --git a/docs/content/docs/subscription-settings.mdx b/docs/content/docs/billing-settings.mdx
similarity index 74%
rename from docs/content/docs/subscription-settings.mdx
rename to docs/content/docs/billing-settings.mdx
index dfa2c1fdd..82ed93dd5 100644
--- a/docs/content/docs/subscription-settings.mdx
+++ b/docs/content/docs/billing-settings.mdx
@@ -1,11 +1,11 @@
---
-title: Subscription settings
+title: Billing
description: Manage your subscription, billing, and usage for Rybbit Cloud
---
import { Callout } from 'fumadocs-ui/components/callout';
-Access subscription settings by hovering over the sidebar and clicking "Subscription".
+Access billing settings by hovering over the sidebar and clicking "Billing".
Subscriptions are scoped to a single organization. If you have multiple organizations, each one requires its own subscription. Switching organizations will show that organization's subscription status.
diff --git a/docs/content/docs/meta.json b/docs/content/docs/meta.json
index da11da294..ef4725fff 100644
--- a/docs/content/docs/meta.json
+++ b/docs/content/docs/meta.json
@@ -31,7 +31,7 @@
"account-settings",
"organization-settings",
"teams",
- "subscription-settings",
+ "billing-settings",
"inviting-users",
"site-settings",
"data-import",
diff --git a/server/src/lib/email/email.ts b/server/src/lib/email/email.ts
index 75e5e8b8e..d44be3b6d 100644
--- a/server/src/lib/email/email.ts
+++ b/server/src/lib/email/email.ts
@@ -8,7 +8,7 @@ import { OnboardingTipEmail } from "./templates/OnboardingTipEmail.js";
import { OtpEmail, type OtpEmailType } from "./templates/OtpEmail.js";
import { ReengagementEmail } from "./templates/ReengagementEmail.js";
import { WeeklyReportEmail } from "./templates/WeeklyReportEmail.js";
-import type { OrganizationReport } from "../../services/weekyReports/weeklyReportTypes.js";
+import type { SiteReport } from "../../services/weekyReports/weeklyReportTypes.js";
import type { OnboardingTipContent } from "../../services/onboardingTips/onboardingTipsContent.js";
import type { ReengagementContent } from "../../services/reengagement/reengagementContent.js";
@@ -201,16 +201,18 @@ export const sendApproachingLimitEmail = async (
export const sendWeeklyReportEmail = async (
email: string,
userName: string,
- organizationReport: OrganizationReport
+ organizationName: string,
+ site: SiteReport
) => {
const html = await render(
WeeklyReportEmail({
userName,
- organizationReport,
+ organizationName,
+ site,
})
);
- const subject = `Weekly Analytics Report - ${organizationReport.sites[0].siteName}`;
+ const subject = `Weekly Analytics Report - ${site.siteName}`;
await sendEmail(email, subject, html);
};
diff --git a/server/src/lib/email/templates/WeeklyReportEmail.tsx b/server/src/lib/email/templates/WeeklyReportEmail.tsx
index b1469dee8..ae3900ce8 100644
--- a/server/src/lib/email/templates/WeeklyReportEmail.tsx
+++ b/server/src/lib/email/templates/WeeklyReportEmail.tsx
@@ -13,11 +13,12 @@ import {
pixelBasedPreset,
} from "@react-email/components";
import * as React from "react";
-import type { OrganizationReport, MetricData } from "../../../services/weekyReports/weeklyReportTypes.js";
+import type { SiteReport, MetricData } from "../../../services/weekyReports/weeklyReportTypes.js";
interface WeeklyReportEmailProps {
userName: string;
- organizationReport: OrganizationReport;
+ organizationName: string;
+ site: SiteReport;
}
interface MetricCardProps {
@@ -242,13 +243,13 @@ const TopListSection = ({ title, items, renderLabel, showFavicon, labelClassName
);
};
-export const WeeklyReportEmail = ({ userName, organizationReport }: WeeklyReportEmailProps) => {
+export const WeeklyReportEmail = ({ userName, organizationName, site }: WeeklyReportEmailProps) => {
const currentYear = new Date().getFullYear();
return (
<Html>
<Head />
- <Preview>Weekly Analytics Report for {organizationReport.organizationName}</Preview>
+ <Preview>Weekly Analytics Report for {organizationName}</Preview>
<Tailwind
config={{
presets: [pixelBasedPreset],
@@ -281,116 +282,113 @@ export const WeeklyReportEmail = ({ userName, organizationReport }: WeeklyReport
<Text className="text-darkText text-base leading-relaxed mb-8">
Here's your weekly analytics summary for{" "}
- <span className="font-semibold">{organizationReport.sites[0].siteDomain}</span>.
+ <span className="font-semibold">{site.siteDomain}</span>.
</Text>
- {/* Sites Reports */}
- {organizationReport.sites.map(site => (
- <Section key={site.siteId} className="mb-10">
- {/* Metrics Cards */}
- <table style={{ width: "100%", marginBottom: "24px" }}>
- <tbody>
- <tr>
- <td style={{ width: "50%", paddingRight: "6px", paddingBottom: "12px" }}>
- <MetricCard
- label="Sessions"
- currentValue={formatNumber(site.currentWeek.sessions)}
- growth={calculateGrowth(site.currentWeek.sessions, site.previousWeek.sessions)}
- isPositive={site.currentWeek.sessions >= site.previousWeek.sessions}
- />
- </td>
- <td style={{ width: "50%", paddingLeft: "6px", paddingBottom: "12px" }}>
- <MetricCard
- label="Pageviews"
- currentValue={formatNumber(site.currentWeek.pageviews)}
- growth={calculateGrowth(site.currentWeek.pageviews, site.previousWeek.pageviews)}
- isPositive={site.currentWeek.pageviews >= site.previousWeek.pageviews}
- />
- </td>
- </tr>
- <tr>
- <td style={{ width: "50%", paddingRight: "6px", paddingBottom: "12px" }}>
- <MetricCard
- label="Unique Users"
- currentValue={formatNumber(site.currentWeek.users)}
- growth={calculateGrowth(site.currentWeek.users, site.previousWeek.users)}
- isPositive={site.currentWeek.users >= site.previousWeek.users}
- />
- </td>
- <td style={{ width: "50%", paddingLeft: "6px", paddingBottom: "12px" }}>
- <MetricCard
- label="Avg Duration"
- currentValue={formatDuration(site.currentWeek.session_duration)}
- growth={calculateGrowth(
- site.currentWeek.session_duration,
- site.previousWeek.session_duration
- )}
- isPositive={site.currentWeek.session_duration >= site.previousWeek.session_duration}
- />
- </td>
- </tr>
- <tr>
- <td style={{ width: "50%", paddingRight: "6px" }}>
- <MetricCard
- label="Pages/Session"
- currentValue={safeToFixed(site.currentWeek.pages_per_session, 1)}
- growth={calculateGrowth(
- site.currentWeek.pages_per_session,
- site.previousWeek.pages_per_session
- )}
- isPositive={
- (site.currentWeek.pages_per_session ?? 0) >= (site.previousWeek.pages_per_session ?? 0)
- }
- />
- </td>
- <td style={{ width: "50%", paddingLeft: "6px" }}>
- <MetricCard
- label="Bounce Rate"
- currentValue={`${safeToFixed(site.currentWeek.bounce_rate, 1)}%`}
- growth={calculateGrowth(site.currentWeek.bounce_rate, site.previousWeek.bounce_rate)}
- isPositive={(site.currentWeek.bounce_rate ?? 0) <= (site.previousWeek.bounce_rate ?? 0)}
- />
- </td>
- </tr>
- </tbody>
- </table>
+ <Section className="mb-10">
+ {/* Metrics Cards */}
+ <table style={{ width: "100%", marginBottom: "24px" }}>
+ <tbody>
+ <tr>
+ <td style={{ width: "50%", paddingRight: "6px", paddingBottom: "12px" }}>
+ <MetricCard
+ label="Sessions"
+ currentValue={formatNumber(site.currentWeek.sessions)}
+ growth={calculateGrowth(site.currentWeek.sessions, site.previousWeek.sessions)}
+ isPositive={site.currentWeek.sessions >= site.previousWeek.sessions}
+ />
+ </td>
+ <td style={{ width: "50%", paddingLeft: "6px", paddingBottom: "12px" }}>
+ <MetricCard
+ label="Pageviews"
+ currentValue={formatNumber(site.currentWeek.pageviews)}
+ growth={calculateGrowth(site.currentWeek.pageviews, site.previousWeek.pageviews)}
+ isPositive={site.currentWeek.pageviews >= site.previousWeek.pageviews}
+ />
+ </td>
+ </tr>
+ <tr>
+ <td style={{ width: "50%", paddingRight: "6px", paddingBottom: "12px" }}>
+ <MetricCard
+ label="Unique Users"
+ currentValue={formatNumber(site.currentWeek.users)}
+ growth={calculateGrowth(site.currentWeek.users, site.previousWeek.users)}
+ isPositive={site.currentWeek.users >= site.previousWeek.users}
+ />
+ </td>
+ <td style={{ width: "50%", paddingLeft: "6px", paddingBottom: "12px" }}>
+ <MetricCard
+ label="Avg Duration"
+ currentValue={formatDuration(site.currentWeek.session_duration)}
+ growth={calculateGrowth(
+ site.currentWeek.session_duration,
+ site.previousWeek.session_duration
+ )}
+ isPositive={site.currentWeek.session_duration >= site.previousWeek.session_duration}
+ />
+ </td>
+ </tr>
+ <tr>
+ <td style={{ width: "50%", paddingRight: "6px" }}>
+ <MetricCard
+ label="Pages/Session"
+ currentValue={safeToFixed(site.currentWeek.pages_per_session, 1)}
+ growth={calculateGrowth(
+ site.currentWeek.pages_per_session,
+ site.previousWeek.pages_per_session
+ )}
+ isPositive={
+ (site.currentWeek.pages_per_session ?? 0) >= (site.previousWeek.pages_per_session ?? 0)
+ }
+ />
+ </td>
+ <td style={{ width: "50%", paddingLeft: "6px" }}>
+ <MetricCard
+ label="Bounce Rate"
+ currentValue={`${safeToFixed(site.currentWeek.bounce_rate, 1)}%`}
+ growth={calculateGrowth(site.currentWeek.bounce_rate, site.previousWeek.bounce_rate)}
+ isPositive={(site.currentWeek.bounce_rate ?? 0) <= (site.previousWeek.bounce_rate ?? 0)}
+ />
+ </td>
+ </tr>
+ </tbody>
+ </table>
- {/* Top Lists Section */}
- <div className="mb-6">
- <TopListSection
- title="Top Countries"
- items={site.topCountries}
- renderLabel={item => getCountryDisplay(item.value)}
- />
- <TopListSection
- title="Top Pages"
- items={site.topPages}
- renderLabel={item => item.value}
- labelClassName="text-darkText text-sm m-0 truncate max-w-[280px]"
- />
- <TopListSection
- title="Top Referrers"
- items={site.topReferrers}
- renderLabel={item => item.value}
- showFavicon={true}
- labelClassName="text-darkText text-sm m-0 truncate"
- />
- <TopListSection
- title="Device Breakdown"
- items={site.deviceBreakdown}
- renderLabel={item => item.value}
- labelClassName="text-darkText text-sm m-0 capitalize"
- className="bg-cardBg border border-borderColor rounded-lg p-4"
- />
- </div>
+ {/* Top Lists Section */}
+ <div className="mb-6">
+ <TopListSection
+ title="Top Countries"
+ items={site.topCountries}
+ renderLabel={item => getCountryDisplay(item.value)}
+ />
+ <TopListSection
+ title="Top Pages"
+ items={site.topPages}
+ renderLabel={item => item.value}
+ labelClassName="text-darkText text-sm m-0 truncate max-w-[280px]"
+ />
+ <TopListSection
+ title="Top Referrers"
+ items={site.topReferrers}
+ renderLabel={item => item.value}
+ showFavicon={true}
+ labelClassName="text-darkText text-sm m-0 truncate"
+ />
+ <TopListSection
+ title="Device Breakdown"
+ items={site.deviceBreakdown}
+ renderLabel={item => item.value}
+ labelClassName="text-darkText text-sm m-0 capitalize"
+ className="bg-cardBg border border-borderColor rounded-lg p-4"
+ />
+ </div>
- <Text className="text-darkText text-base leading-relaxed mb-4">
- <Link href={`https://app.rybbit.io/${site.siteId}`} className="text-brand underline">
- View full dashboard
- </Link>
- </Text>
- </Section>
- ))}
+ <Text className="text-darkText text-base leading-relaxed mb-4">
+ <Link href={`https://app.rybbit.io/${site.siteId}`} className="text-brand underline">
+ View full dashboard
+ </Link>
+ </Text>
+ </Section>
<Text className="text-mutedText text-sm leading-relaxed">
This report covers the last 7 days of analytics data.
diff --git a/server/src/services/weekyReports/weeklyReportService.ts b/server/src/services/weekyReports/weeklyReportService.ts
index ce0d82d5c..0204ec862 100644
--- a/server/src/services/weekyReports/weeklyReportService.ts
+++ b/server/src/services/weekyReports/weeklyReportService.ts
@@ -362,14 +362,7 @@ class WeeklyReportService {
}
try {
- // Create a report with just this single site
- const singleSiteReport: OrganizationReport = {
- organizationId: report.organizationId,
- organizationName: report.organizationName,
- sites: [site],
- };
-
- await sendWeeklyReportEmail(memberData.email, memberData.name, singleSiteReport);
+ await sendWeeklyReportEmail(memberData.email, memberData.name, report.organizationName, site);
this.logger.info(
{
email: memberData.email,