Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@btst/better-auth-ui",
"homepage": "https://www.better-stack.ai/",
"version": "1.2.2",
"version": "1.2.3",
"description": "Plug & play shadcn/ui components for better-auth",
"repository": {
"type": "git",
Expand Down Expand Up @@ -96,7 +96,8 @@
"author": "daveycodez",
"license": "MIT",
"devDependencies": {
"@better-auth/passkey": "^1.4.7",
"@better-auth/api-key": "^1.5.5",
"@better-auth/passkey": "^1.5.4",
"@biomejs/biome": "2.3.10",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-context": "^1.1.3",
Expand All @@ -115,7 +116,7 @@
"@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3",
"@types/react-google-recaptcha": "^2.1.9",
"better-auth": "^1.4.7",
"better-auth": "^1.5.5",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"esbuild-plugin-preserve-directives": "^0.0.11",
Expand All @@ -129,11 +130,12 @@
"turbo": "^2.6.3",
"typescript": "^5.9.3",
"vitest": "^4.0.18",
"zod": "^4.2.1"
"zod": "^4.3.6"
},
"peerDependencies": {
"@better-auth/api-key": ">=1.5.5",
"@better-auth/passkey": ">=1.4.6",
"@btst/stack": ">=2.6.1",
"@btst/stack": ">=2.7.0",
"@btst/yar": "^1.1.1",
"@captchafox/react": "^1.10.0",
"@daveyplate/better-auth-tanstack": "^1.3.6",
Expand Down Expand Up @@ -181,6 +183,14 @@
"ua-parser-js": "^2.0.7",
"vaul": "^1.1.2"
},
"peerDependenciesMeta": {
"@better-auth/api-key": {
"optional": true
}
},
"packageManager": "pnpm@10.26.2",
"overrides": {}
"overrides": {
"zod": "4.3.6",
"better-call": "1.3.2"
}
}
897 changes: 673 additions & 224 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/organization/member-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function MemberCell({

const { data: hasPermissionToUpdateMember } = useHasPermission({
organizationId: member.organizationId,
permission: { member: ["update"] }
permissions: { member: ["update"] }
})

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/organization/organization-members-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function OrganizationMembersContent({
isPending: isPendingUpdateMember
} = useHasPermission({
organizationId: organization.id,
permission: {
permissions: {
member: ["update"]
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/organization/organization-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ export function OrganizationSwitcher({
))}

{organizations?.map(
(organization) =>
(organization: Organization) =>
organization.id !== activeOrganization?.id &&
(pathMode === "slug" ? (
<Link
Expand Down
3 changes: 2 additions & 1 deletion src/components/organization/organizations-card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use client"
import type { Organization } from "better-auth/plugins/organization"
import { useContext, useMemo, useState } from "react"

import { useIsHydrated } from "../../hooks/use-hydrated"
Expand Down Expand Up @@ -50,7 +51,7 @@ export function OrganizationsCard({
>
<CardContent className={cn("grid gap-4", classNames?.content)}>
{isPending && <SettingsCellSkeleton />}
{organizations?.map((organization) => (
{organizations?.map((organization: Organization) => (
<OrganizationCell
key={organization.id}
classNames={classNames}
Expand Down
10 changes: 7 additions & 3 deletions src/types/auth-client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { apiKeyClient } from "@better-auth/api-key/client"
import { passkeyClient } from "@better-auth/passkey/client"
import {
anonymousClient,
apiKeyClient,
emailOTPClient,
genericOAuthClient,
magicLinkClient,
Expand All @@ -13,7 +13,11 @@ import {
} from "better-auth/client/plugins"
import { createAuthClient } from "better-auth/react"

export const authClient = createAuthClient({
// Not exported — used only for type inference via typeof below.
// Exporting it as a value causes tsup to try to serialize the complex inferred
// type into .d.ts files, which triggers TS2742/TS7056 errors when multiple
// versions of @better-auth/core exist in the pnpm store.
const _authClient = createAuthClient({
// Provide a placeholder baseURL to prevent errors in non-HTTP environments
// (e.g., Tauri, Electron where window.location.origin is tauri:// or file://)
// This client is only used for type inference and should not be used at runtime.
Expand All @@ -40,7 +44,7 @@ export const authClient = createAuthClient({
]
})

export type AuthClient = typeof authClient
export type AuthClient = typeof _authClient

export type Session = AuthClient["$Infer"]["Session"]["session"]
export type User = AuthClient["$Infer"]["Session"]["user"]
7 changes: 3 additions & 4 deletions src/types/auth-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Passkey } from "@better-auth/passkey"
import type { BetterFetchError } from "@better-fetch/fetch"
import type { Account, User } from "better-auth"
import type { Member } from "better-auth/plugins/organization"
import type { Member, Organization } from "better-auth/plugins/organization"
import type { AnyAuthClient } from "./any-auth-client"
import type { ApiKey } from "./api-key"
import type { AuthClient } from "./auth-client"
Expand All @@ -12,6 +12,7 @@ type AnyAuthSession = AnyAuthClient["$Infer"]["Session"]

type AuthHook<T> = {
isPending: boolean
isRefetching?: boolean
data?: T | null
error?: BetterFetchError | null
refetch?: Refetch
Expand All @@ -30,9 +31,7 @@ export type AuthHooks = {
useActiveOrganization: () => Partial<
ReturnType<AuthClient["useActiveOrganization"]>
>
useListOrganizations: () => Partial<
ReturnType<AuthClient["useListOrganizations"]>
>
useListOrganizations: () => AuthHook<Organization[]>
useHasPermission: (
params: Parameters<AuthClient["organization"]["hasPermission"]>[0]
) => AuthHook<{
Expand Down
Loading