Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

add note to billing page

daniel31x13bde70c0b7dab
diff --git a/apps/web/lib/api/controllers/users/userId/getUserById.ts b/apps/web/lib/api/controllers/users/userId/getUserById.ts
index e5da22b8..e1b6071c 100644
--- a/apps/web/lib/api/controllers/users/userId/getUserById.ts
+++ b/apps/web/lib/api/controllers/users/userId/getUserById.ts
@@ -52,6 +52,7 @@ export default async function getUserById(userId: number) {
subscription: {
active: subscriptions?.active ?? false,
quantity: subscriptions?.quantity ?? 0,
+ provider: subscriptions?.provider,
},
parentSubscription: {
active: parentSubscription?.active,
diff --git a/apps/web/lib/api/controllers/users/userId/updateUserById.ts b/apps/web/lib/api/controllers/users/userId/updateUserById.ts
index 3230f5f5..b7ad6a38 100644
--- a/apps/web/lib/api/controllers/users/userId/updateUserById.ts
+++ b/apps/web/lib/api/controllers/users/userId/updateUserById.ts
@@ -255,6 +255,7 @@ export default async function updateUserById(
subscription: {
active: subscriptions?.active,
quantity: subscriptions?.quantity,
+ provider: subscriptions?.provider,
},
parentSubscription: {
active: parentSubscription?.active,
diff --git a/apps/web/lib/api/controllers/users/userId/updateUserPreference.ts b/apps/web/lib/api/controllers/users/userId/updateUserPreference.ts
index 1ade267d..b30f22d0 100644
--- a/apps/web/lib/api/controllers/users/userId/updateUserPreference.ts
+++ b/apps/web/lib/api/controllers/users/userId/updateUserPreference.ts
@@ -53,6 +53,7 @@ export default async function updateUserPreference(
subscription: {
active: subscriptions?.active,
quantity: subscriptions?.quantity,
+ provider: subscriptions?.provider,
},
parentSubscription: {
active: parentSubscription?.active,
diff --git a/apps/web/pages/settings/billing.tsx b/apps/web/pages/settings/billing.tsx
index 2d878c7e..02f49c4b 100644
--- a/apps/web/pages/settings/billing.tsx
+++ b/apps/web/pages/settings/billing.tsx
@@ -73,6 +73,8 @@ const Page: NextPageWithLayout = () => {
});
const [inviteModal, setInviteModal] = useState(false);
+ const isRevenueCatSubscription =
+ account?.subscription?.provider === "REVENUECAT";
return (
<>
@@ -85,215 +87,240 @@ const Page: NextPageWithLayout = () => {
<Separator className="my-3" />
- <div className="w-full mx-auto flex flex-col gap-3 justify-between">
- <p className="text-md">
- {t("manage_subscription_intro")}{" "}
- <a
- href={process.env.NEXT_PUBLIC_STRIPE_BILLING_PORTAL_URL}
- className="underline"
- target="_blank"
- >
- {t("billing_portal")}
- </a>
- .
- </p>
+ {isRevenueCatSubscription ? (
+ <div className="w-full mx-auto flex flex-col gap-3 justify-between">
+ <p className="text-md">{t("mobile_billing_managed_externally")}</p>
- <p className="text-md">
- {t("help_contact_intro")}{" "}
- <a className="font-semibold" href="mailto:[email protected]">
- </a>
- </p>
- </div>
+ <p className="text-md">
+ {t("help_contact_intro")}{" "}
+ <a className="font-semibold" href="mailto:[email protected]">
+ </a>
+ </p>
+ </div>
+ ) : (
+ <>
+ <div className="w-full mx-auto flex flex-col gap-3 justify-between">
+ <p className="text-md">
+ {t("manage_subscription_intro")}{" "}
+ <a
+ href={process.env.NEXT_PUBLIC_STRIPE_BILLING_PORTAL_URL}
+ className="underline"
+ target="_blank"
+ >
+ {t("billing_portal")}
+ </a>
+ .
+ </p>
- <div className="flex items-center gap-2 w-full rounded-md h-8 mt-5">
- <p className="truncate w-full pr-7 text-3xl font-thin">
- {t("manage_seats")}
- </p>
- </div>
+ <p className="text-md">
+ {t("help_contact_intro")}{" "}
+ <a className="font-semibold" href="mailto:[email protected]">
+ </a>
+ </p>
+ </div>
- <Separator className="my-3" />
+ <div className="flex items-center gap-2 w-full rounded-md h-8 mt-5">
+ <p className="truncate w-full pr-7 text-3xl font-thin">
+ {t("manage_seats")}
+ </p>
+ </div>
- <div className="flex items-center justify-between gap-2 mb-3 relative">
- <div>
- <label
- htmlFor="search-box"
- className="inline-flex items-center w-fit absolute left-1 pointer-events-none rounded-md p-1 text-primary"
- >
- <i className="bi-search"></i>
- </label>
+ <Separator className="my-3" />
- <input
- id="search-box"
- type="text"
- placeholder={t("search_users")}
- value={searchQuery}
- onChange={(e) => {
- setSearchQuery(e.target.value);
+ <div className="flex items-center justify-between gap-2 mb-3 relative">
+ <div>
+ <label
+ htmlFor="search-box"
+ className="inline-flex items-center w-fit absolute left-1 pointer-events-none rounded-md p-1 text-primary"
+ >
+ <i className="bi-search"></i>
+ </label>
- if (users) {
- setFilteredUsers(
- users.filter((user: any) =>
- JSON.stringify(user)
- .toLowerCase()
- .includes(e.target.value.toLowerCase())
- )
- );
- }
- }}
- className="border border-neutral-content bg-base-200 focus:border-primary py-1 rounded-md pl-9 pr-2 w-full max-w-[15rem] md:w-[15rem] md:max-w-full duration-200 outline-none"
- />
- </div>
+ <input
+ id="search-box"
+ type="text"
+ placeholder={t("search_users")}
+ value={searchQuery}
+ onChange={(e) => {
+ setSearchQuery(e.target.value);
- <div className="flex gap-3">
- <Button
- variant="accent"
- onClick={() => setInviteModal(true)}
- className="flex items-center px-2 h-[2.15rem] relative"
- >
- <p>{t("invite_user")}</p>
- <i className="bi-plus text-xl"></i>
- </Button>
- </div>
- </div>
+ if (users) {
+ setFilteredUsers(
+ users.filter((user: any) =>
+ JSON.stringify(user)
+ .toLowerCase()
+ .includes(e.target.value.toLowerCase())
+ )
+ );
+ }
+ }}
+ className="border border-neutral-content bg-base-200 focus:border-primary py-1 rounded-md pl-9 pr-2 w-full max-w-[15rem] md:w-[15rem] md:max-w-full duration-200 outline-none"
+ />
+ </div>
- <div className="border rounded-md shadow border-neutral-content">
- <table className="table bg-base-300 rounded-md">
- <thead>
- <tr className="sm:table-row hidden border-b-neutral-content">
- {process.env.NEXT_PUBLIC_EMAIL_PROVIDER === "true" && (
- <th>{t("email")}</th>
- )}
- {process.env.NEXT_PUBLIC_STRIPE === "true" && (
- <th>{t("status")}</th>
- )}
- <th>{t("date_added")}</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {filteredUsers?.map((user, index) => (
- <tr
- key={index}
- className={clsx(
- "group border-b-neutral-content last:border-b-0 duration-100 w-full relative flex flex-col sm:table-row",
- user.id !== account?.id &&
- "hover:bg-neutral-content hover:bg-opacity-30"
- )}
+ <div className="flex gap-3">
+ <Button
+ variant="accent"
+ onClick={() => setInviteModal(true)}
+ className="flex items-center px-2 h-[2.15rem] relative"
>
- {process.env.NEXT_PUBLIC_EMAIL_PROVIDER === "true" && (
- <td className="truncate max-w-full" title={user.email || ""}>
- <p className="sm:hidden block text-neutral text-xs font-bold mb-2">
- {t("email")}
- </p>
- <p>{user.email}</p>
- </td>
- )}
- {process.env.NEXT_PUBLIC_STRIPE === "true" && (
- <td>
- <p className="sm:hidden block text-neutral text-xs font-bold mb-2">
- {t("status")}
- </p>
- {user.emailVerified ? (
- <p className="font-bold px-2 bg-green-600 text-white rounded-md w-fit">
- {t("active")}
+ <p>{t("invite_user")}</p>
+ <i className="bi-plus text-xl"></i>
+ </Button>
+ </div>
+ </div>
+
+ <div className="border rounded-md shadow border-neutral-content">
+ <table className="table bg-base-300 rounded-md">
+ <thead>
+ <tr className="sm:table-row hidden border-b-neutral-content">
+ {process.env.NEXT_PUBLIC_EMAIL_PROVIDER === "true" && (
+ <th>{t("email")}</th>
+ )}
+ {process.env.NEXT_PUBLIC_STRIPE === "true" && (
+ <th>{t("status")}</th>
+ )}
+ <th>{t("date_added")}</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {filteredUsers?.map((user, index) => (
+ <tr
+ key={index}
+ className={clsx(
+ "group border-b-neutral-content last:border-b-0 duration-100 w-full relative flex flex-col sm:table-row",
+ user.id !== account?.id &&
+ "hover:bg-neutral-content hover:bg-opacity-30"
+ )}
+ >
+ {process.env.NEXT_PUBLIC_EMAIL_PROVIDER === "true" && (
+ <td
+ className="truncate max-w-full"
+ title={user.email || ""}
+ >
+ <p className="sm:hidden block text-neutral text-xs font-bold mb-2">
+ {t("email")}
+ </p>
+ <p>{user.email}</p>
+ </td>
+ )}
+ {process.env.NEXT_PUBLIC_STRIPE === "true" && (
+ <td>
+ <p className="sm:hidden block text-neutral text-xs font-bold mb-2">
+ {t("status")}
+ </p>
+ {user.emailVerified ? (
+ <p className="font-bold px-2 bg-green-600 text-white rounded-md w-fit">
+ {t("active")}
+ </p>
+ ) : (
+ <p className="font-bold px-2 bg-neutral-content rounded-md w-fit">
+ {t("pending")}
+ </p>
+ )}
+ </td>
+ )}
+ <td>
+ <p className="sm:hidden block text-neutral text-xs font-bold mb-2">
+ {t("date_added")}
</p>
- ) : (
- <p className="font-bold px-2 bg-neutral-content rounded-md w-fit">
- {t("pending")}
+ <p className="whitespace-nowrap">
+ {new Date(user.createdAt).toLocaleDateString(
+ t("locale"),
+ {
+ month: "short",
+ day: "numeric",
+ year: "numeric",
+ }
+ )}
</p>
- )}
- </td>
- )}
- <td>
- <p className="sm:hidden block text-neutral text-xs font-bold mb-2">
- {t("date_added")}
- </p>
- <p className="whitespace-nowrap">
- {new Date(user.createdAt).toLocaleDateString(t("locale"), {
- month: "short",
- day: "numeric",
- year: "numeric",
- })}
- </p>
- </td>
- <td className="relative">
- {user.id !== account?.id && (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- variant="ghost"
- size="icon"
- onMouseDown={(e) => e.preventDefault()}
- title={t("more")}
- className="ml-auto block"
- >
- <i
- className={"bi bi-three-dots text-lg text-neutral"}
- ></i>
- </Button>
- </DropdownMenuTrigger>
+ </td>
+ <td className="relative">
+ {user.id !== account?.id && (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon"
+ onMouseDown={(e) => e.preventDefault()}
+ title={t("more")}
+ className="ml-auto block"
+ >
+ <i
+ className={
+ "bi bi-three-dots text-lg text-neutral"
+ }
+ ></i>
+ </Button>
+ </DropdownMenuTrigger>
+
+ <DropdownMenuContent
+ sideOffset={4}
+ align="end"
+ className="bg-base-200 border border-neutral-content rounded-box p-1"
+ >
+ {!user.emailVerified && (
+ <>
+ <DropdownMenuItem
+ onClick={() => {
+ signIn("invite", {
+ email: user.email,
+ callbackUrl: "/member-onboarding",
+ redirect: false,
+ }).then(() =>
+ toast.success(t("resend_invite_success"))
+ );
+ }}
+ >
+ <i className="bi-envelope"></i>
+ {t("resend_invite")}
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ </>
+ )}
- <DropdownMenuContent
- sideOffset={4}
- align="end"
- className="bg-base-200 border border-neutral-content rounded-box p-1"
- >
- {!user.emailVerified && (
- <>
<DropdownMenuItem
onClick={() => {
- signIn("invite", {
- email: user.email,
- callbackUrl: "/member-onboarding",
- redirect: false,
- }).then(() =>
- toast.success(t("resend_invite_success"))
- );
+ setDeleteUserModal({
+ isOpen: true,
+ userId: user.id,
+ });
}}
+ className="text-error"
>
- <i className="bi-envelope"></i>
- {t("resend_invite")}
+ <i className="bi-trash"></i>
+ {t("remove_user")}
</DropdownMenuItem>
- <DropdownMenuSeparator />
- </>
- )}
-
- <DropdownMenuItem
- onClick={() => {
- setDeleteUserModal({
- isOpen: true,
- userId: user.id,
- });
- }}
- className="text-error"
- >
- <i className="bi-trash"></i>
- {t("remove_user")}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- )}
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
- <p className="text-sm text-center font-bold mt-3">
- {t(
- account?.subscription?.quantity === 1
- ? "seat_purchased"
- : "seats_purchased",
- { count: account?.subscription?.quantity }
- )}
- </p>
- {inviteModal && <InviteModal onClose={() => setInviteModal(false)} />}
- {deleteUserModal.isOpen && deleteUserModal.userId && (
- <DeleteUserModal
- onClose={() => setDeleteUserModal({ isOpen: false, userId: null })}
- userId={deleteUserModal.userId}
- />
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ <p className="text-sm text-center font-bold mt-3">
+ {t(
+ account?.subscription?.quantity === 1
+ ? "seat_purchased"
+ : "seats_purchased",
+ { count: account?.subscription?.quantity }
+ )}
+ </p>
+ {inviteModal && <InviteModal onClose={() => setInviteModal(false)} />}
+ {deleteUserModal.isOpen && deleteUserModal.userId && (
+ <DeleteUserModal
+ onClose={() =>
+ setDeleteUserModal({ isOpen: false, userId: null })
+ }
+ userId={deleteUserModal.userId}
+ />
+ )}
+ </>
)}
</>
);
diff --git a/apps/web/public/locales/en/common.json b/apps/web/public/locales/en/common.json
index 2e292da1..7cff71fe 100644
--- a/apps/web/public/locales/en/common.json
+++ b/apps/web/public/locales/en/common.json
@@ -128,6 +128,7 @@
"billing_settings": "Billing Settings",
"manage_subscription_intro": "To manage/cancel your subscription, visit the",
"billing_portal": "Billing Portal",
+ "mobile_billing_managed_externally": "Your subscription is managed through the App Store or Google Play Store. To change or cancel it, open your device's subscription settings. Seat management is also not available for subscriptions made through the mobile app at the moment.",
"help_contact_intro": "If you still need help or encountered any issues, feel free to reach out to us at:",
"fill_required_fields": "Please fill the required fields.",
"deleting_message": "Deleting everything, please wait...",
diff --git a/packages/types/global.ts b/packages/types/global.ts
index 32715bfc..b30b7b3b 100644
--- a/packages/types/global.ts
+++ b/packages/types/global.ts
@@ -225,7 +225,10 @@ export interface WorkerStats {
}
export type GetUserByIdResponse = Omit<User, "password"> &
- Partial<{ subscription: Pick<Subscription, "active" | "quantity"> }> & {
+ Partial<{
+ subscription: Pick<Subscription, "active" | "quantity"> &
+ Partial<Pick<Subscription, "provider">>;
+ }> & {
parentSubscription: {
active: boolean | undefined;
user: {