diff --git a/src/app/(dashboard)/[orgSlug]/billing/page.tsx b/src/app/(dashboard)/[orgSlug]/billing/page.tsx
index 7974127..3f1c719 100644
--- a/src/app/(dashboard)/[orgSlug]/billing/page.tsx
+++ b/src/app/(dashboard)/[orgSlug]/billing/page.tsx
@@ -29,7 +29,6 @@ export default function BillingPage() {
(null)
export function SidebarStateProvider({ children }: { children: React.ReactNode }) {
- const [collapsed, setCollapsed] = useState(false)
- const [hydrated, setHydrated] = useState(false)
-
- useEffect(() => {
- const stored = window.localStorage.getItem(SIDEBAR_STORAGE_KEY)
- if (stored === 'true') setCollapsed(true)
- setHydrated(true)
- }, [])
+ const [collapsed, setCollapsed] = useState(() => {
+ if (typeof window !== 'undefined') {
+ return window.localStorage.getItem(SIDEBAR_STORAGE_KEY) === 'true'
+ }
+ return false
+ })
+ const [hydrated] = useState(() => typeof window !== 'undefined')
useEffect(() => {
if (hydrated) {
diff --git a/src/lib/credits/balance.test.ts b/src/lib/credits/balance.test.ts
index ce715f6..819afbe 100644
--- a/src/lib/credits/balance.test.ts
+++ b/src/lib/credits/balance.test.ts
@@ -18,7 +18,7 @@ vi.mock('@/lib/db/schema', () => ({
import { getBalance, checkSufficientBalance, deductCredits, addCredits } from './balance'
function mockSelectChain(balance: string) {
- const chain: Record = {}
+ const chain: Record = {}
chain.from = vi.fn(() => chain)
chain.where = vi.fn(() => chain)
chain.limit = vi.fn(() => Promise.resolve([{ balance }]))
@@ -35,7 +35,7 @@ describe('getBalance', () => {
})
it('returns 0 when no org found', async () => {
- const chain: Record = {}
+ const chain: Record = {}
chain.from = vi.fn(() => chain)
chain.where = vi.fn(() => chain)
chain.limit = vi.fn(() => Promise.resolve([]))
diff --git a/src/lib/credits/balance.ts b/src/lib/credits/balance.ts
index 2e4a9d0..b947b37 100644
--- a/src/lib/credits/balance.ts
+++ b/src/lib/credits/balance.ts
@@ -1,5 +1,5 @@
import { db } from '@/lib/db'
-import { organizations, creditTransactions } from '@/lib/db/schema'
+import { organizations } from '@/lib/db/schema'
import { eq, sql } from 'drizzle-orm'
interface DeductMeta {
diff --git a/src/lib/stripe/ensure-customer.test.ts b/src/lib/stripe/ensure-customer.test.ts
index bc9515a..7538858 100644
--- a/src/lib/stripe/ensure-customer.test.ts
+++ b/src/lib/stripe/ensure-customer.test.ts
@@ -51,6 +51,7 @@ describe('ensureStripeCustomer', () => {
it('returns existing stripe_customer_id if valid in current mode', async () => {
const org = makeOrg({ stripe_customer_id: 'cus_existing' })
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.mocked(stripe.customers.retrieve).mockResolvedValue({ id: 'cus_existing' } as any)
const result = await ensureStripeCustomer(org)
@@ -62,10 +63,12 @@ describe('ensureStripeCustomer', () => {
it('creates new customer if existing ID is from wrong Stripe mode', async () => {
const org = makeOrg({ stripe_customer_id: 'cus_live_mode_id' })
vi.mocked(stripe.customers.retrieve).mockRejectedValue(new Error('No such customer'))
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.mocked(stripe.customers.create).mockResolvedValue({ id: 'cus_test_new' } as any)
const mockEq = vi.fn().mockResolvedValue({ data: null, error: null })
const mockUpdate = vi.fn(() => ({ eq: mockEq }))
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.mocked(supabaseAdmin.from).mockReturnValue({ update: mockUpdate } as any)
const result = await ensureStripeCustomer(org)
@@ -76,10 +79,12 @@ describe('ensureStripeCustomer', () => {
it('creates a Stripe customer when none exists', async () => {
const org = makeOrg({ stripe_customer_id: null })
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.mocked(stripe.customers.create).mockResolvedValue({ id: 'cus_new123' } as any)
const mockEq = vi.fn().mockResolvedValue({ data: null, error: null })
const mockUpdate = vi.fn(() => ({ eq: mockEq }))
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.mocked(supabaseAdmin.from).mockReturnValue({ update: mockUpdate } as any)
const result = await ensureStripeCustomer(org)
diff --git a/src/lib/stripe/webhooks.test.ts b/src/lib/stripe/webhooks.test.ts
index 8a477f6..4ca9ae9 100644
--- a/src/lib/stripe/webhooks.test.ts
+++ b/src/lib/stripe/webhooks.test.ts
@@ -47,7 +47,9 @@ vi.mock('@/lib/constants', () => ({
import { handleStripeEvent } from './webhooks'
-function chainMock(returnValue: unknown) {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function chainMock(returnValue: unknown): Record {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
const chain: Record = {}
const terminal = () => Promise.resolve(returnValue)
const methods = ['from', 'select', 'update', 'insert', 'eq', 'in', 'single', 'order', 'limit']
@@ -181,7 +183,7 @@ describe('handleStripeEvent', () => {
describe('payment_intent.succeeded', () => {
it('adds credits for credit_topup payment intents', async () => {
const txnChain = chainMock({ data: [], error: null })
- txnChain.single = undefined as any
+ txnChain.single = undefined as unknown
txnChain.limit = vi.fn(() => Promise.resolve({ data: [], error: null }))
const orgChain = chainMock({ data: null, error: null })
diff --git a/src/lib/stripe/webhooks.ts b/src/lib/stripe/webhooks.ts
index a3ce2b2..f723242 100644
--- a/src/lib/stripe/webhooks.ts
+++ b/src/lib/stripe/webhooks.ts
@@ -198,7 +198,7 @@ async function handlePaymentIntentFailed(pi: Stripe.PaymentIntent): Promise {
+async function handleSubscriptionCreated(_sub: Stripe.Subscription): Promise { // eslint-disable-line @typescript-eslint/no-unused-vars
// Instance creation is handled in handleCheckoutCompleted.
}