chore: atualizações de dependências, lint fixes e ajustes menores

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Felipe Coutinho
2026-02-15 21:35:39 +00:00
parent 2362a70b9d
commit b9f788312c
35 changed files with 637 additions and 824 deletions

View File

@@ -585,7 +585,10 @@ export async function generateInsightsAction(
const selectedModel = AVAILABLE_MODELS.find((m) => m.id === modelId);
// Se não encontrou na lista e não tem "/" (formato OpenRouter), é inválido
if (!selectedModel && !modelId.includes("/")) {
const isOpenRouterFormat = /^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(
modelId,
);
if (!selectedModel && !isOpenRouterFormat) {
return {
success: false,
error: "Modelo inválido.",
@@ -599,7 +602,7 @@ export async function generateInsightsAction(
let model;
// Se o modelo tem "/" é OpenRouter (formato: provider/model)
if (modelId.includes("/")) {
if (isOpenRouterFormat && !selectedModel) {
const apiKey = process.env.OPENROUTER_API_KEY;
if (!apiKey) {
return {
@@ -675,10 +678,7 @@ Responda APENAS com um JSON válido seguindo exatamente o schema especificado.`,
console.error("Error generating insights:", error);
return {
success: false,
error:
error instanceof Error
? error.message
: "Erro ao gerar insights. Tente novamente.",
error: "Erro ao gerar insights. Tente novamente.",
};
}
}
@@ -776,10 +776,7 @@ export async function saveInsightsAction(
console.error("Error saving insights:", error);
return {
success: false,
error:
error instanceof Error
? error.message
: "Erro ao salvar análise. Tente novamente.",
error: "Erro ao salvar análise. Tente novamente.",
};
}
}
@@ -837,10 +834,7 @@ export async function loadSavedInsightsAction(period: string): Promise<
console.error("Error loading saved insights:", error);
return {
success: false,
error:
error instanceof Error
? error.message
: "Erro ao carregar análise salva. Tente novamente.",
error: "Erro ao carregar análise salva. Tente novamente.",
};
}
}
@@ -871,10 +865,7 @@ export async function deleteSavedInsightsAction(
console.error("Error deleting saved insights:", error);
return {
success: false,
error:
error instanceof Error
? error.message
: "Erro ao remover análise. Tente novamente.",
error: "Erro ao remover análise. Tente novamente.",
};
}
}

View File

@@ -62,7 +62,12 @@ export async function markInboxAsProcessedAction(
processedAt: new Date(),
updatedAt: new Date(),
})
.where(eq(preLancamentos.id, data.inboxItemId));
.where(
and(
eq(preLancamentos.id, data.inboxItemId),
eq(preLancamentos.userId, user.id),
),
);
revalidateInbox();
@@ -104,7 +109,12 @@ export async function discardInboxItemAction(
discardedAt: new Date(),
updatedAt: new Date(),
})
.where(eq(preLancamentos.id, data.inboxItemId));
.where(
and(
eq(preLancamentos.id, data.inboxItemId),
eq(preLancamentos.userId, user.id),
),
);
revalidateInbox();

View File

@@ -1,4 +1,4 @@
import { desc, eq } from "drizzle-orm";
import { and, desc, eq, isNull } from "drizzle-orm";
import { headers } from "next/headers";
import { NextResponse } from "next/server";
import { tokensApi } from "@/db/schema";
@@ -15,7 +15,7 @@ export async function GET() {
}
// Buscar tokens ativos do usuário
const tokens = await db
const activeTokens = await db
.select({
id: tokensApi.id,
name: tokensApi.name,
@@ -26,14 +26,11 @@ export async function GET() {
createdAt: tokensApi.createdAt,
})
.from(tokensApi)
.where(eq(tokensApi.userId, session.user.id))
.where(
and(eq(tokensApi.userId, session.user.id), isNull(tokensApi.revokedAt)),
)
.orderBy(desc(tokensApi.createdAt));
// Separar tokens ativos e revogados
const activeTokens = tokens.filter(
(t) => !t.expiresAt || new Date(t.expiresAt) > new Date(),
);
return NextResponse.json({ tokens: activeTokens });
} catch (error) {
console.error("[API] Error listing device tokens:", error);

View File

@@ -36,8 +36,7 @@ export async function GET() {
name: "OpenSheets",
version: APP_VERSION,
timestamp: new Date().toISOString(),
message:
error instanceof Error ? error.message : "Database connection failed",
message: "Database connection failed",
},
{ status: 503 },
);

View File

@@ -170,7 +170,7 @@ export function CardItem({
width={42}
height={42}
className={cn(
"rounded-lg",
"rounded-full",
isInactive && "grayscale opacity-40",
)}
/>
@@ -216,7 +216,7 @@ export function CardItem({
width={42}
height={42}
className={cn(
"h-6 w-auto rounded",
"h-6 w-auto rounded-full",
isInactive && "grayscale opacity-40",
)}
/>

View File

@@ -40,7 +40,7 @@ export function BrandSelectContent({ label }: { label: string }) {
alt={`Logo ${label}`}
width={24}
height={24}
className="rounded object-contain"
className="rounded-full object-contain"
/>
) : (
<RiBankLine className="size-5 text-muted-foreground" aria-hidden />
@@ -74,7 +74,7 @@ export function AccountSelectContent({ label, logo }: SelectItemContentProps) {
alt={`Logo de ${label}`}
width={20}
height={20}
className="rounded"
className="rounded-full"
/>
) : (
<RiBankLine className="size-4 text-muted-foreground" aria-hidden />

View File

@@ -57,7 +57,7 @@ export function CategoryIconBadge({
return (
<div
className={cn(
"flex shrink-0 items-center justify-center overflow-hidden rounded-lg",
"flex shrink-0 items-center justify-center overflow-hidden rounded-full",
variant.container,
className,
)}
@@ -66,10 +66,7 @@ export function CategoryIconBadge({
{IconComponent ? (
<IconComponent className={variant.icon} style={{ color }} />
) : (
<span
className={cn("font-semibold uppercase", variant.text)}
style={{ color }}
>
<span className={cn("uppercase", variant.text)} style={{ color }}>
{initials}
</span>
)}

View File

@@ -75,7 +75,7 @@ export function AccountStatementCard({
<CardHeader className="flex flex-col gap-3">
<div className="flex items-start gap-3">
{logoPath ? (
<div className="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border/60 bg-background">
<div className="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border/60 bg-background">
<Image
src={logoPath}
alt={`Logo da conta ${accountName}`}

View File

@@ -155,7 +155,7 @@ export function AccountsPage({
alt={`Logo da conta ${account.name}`}
width={42}
height={42}
className="rounded-lg"
className="rounded-full"
/>
) : undefined
}

View File

@@ -86,7 +86,7 @@ export function ExpensesByCategoryWidget({
>
<div className="flex items-center justify-between gap-3">
<div className="flex min-w-0 flex-1 items-center gap-2">
<div className="flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted">
<div className="flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted">
{IconComponent ? (
<IconComponent className="size-4 text-foreground" />
) : (

View File

@@ -86,7 +86,7 @@ export function IncomeByCategoryWidget({
>
<div className="flex items-center justify-between gap-3">
<div className="flex min-w-0 flex-1 items-center gap-2">
<div className="flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted">
<div className="flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted">
{IconComponent ? (
<IconComponent className="size-4 text-foreground" />
) : (

View File

@@ -40,7 +40,7 @@ export function AnalysisSummaryPanel({
{/* Mensagem quando nada está selecionado */}
{selectedCount === 0 && (
<div className="rounded-lg bg-muted/50 p-3 text-center">
<div className="rounded-full bg-muted/50 p-3 text-center">
<p className="text-xs text-muted-foreground">
Selecione parcelas para ver o resumo
</p>

View File

@@ -61,10 +61,10 @@ export function PendingInvoiceCard({
alt={invoice.cartaoName}
width={24}
height={24}
className="size-6 rounded"
className="size-6 rounded-full"
/>
) : (
<div className="flex size-6 items-center justify-center rounded bg-muted">
<div className="flex size-6 items-center justify-center rounded-full bg-muted">
<RiBillLine className="size-4 text-muted-foreground" />
</div>
)}

View File

@@ -259,7 +259,7 @@ export function InvoicesWidget({ invoices }: InvoicesWidgetProps) {
className="flex items-center justify-between border-b border-dashed last:border-b-0 last:pb-0"
>
<div className="flex min-w-0 flex-1 items-center gap-2 py-2">
<div className="flex size-9.5 shrink-0 items-center justify-center overflow-hidden rounded-lg">
<div className="flex size-9.5 shrink-0 items-center justify-center overflow-hidden rounded-full">
{logo ? (
<Image
src={logo}
@@ -456,7 +456,7 @@ export function InvoicesWidget({ invoices }: InvoicesWidgetProps) {
{selectedInvoice ? (
<div className="flex flex-col gap-4">
<div className="flex items-center gap-3 rounded-lg border border-border/60 bg-muted/50 p-3">
<div className="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border/60 bg-background">
<div className="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border/60 bg-background">
{selectedLogo ? (
<Image
src={selectedLogo}

View File

@@ -1,4 +1,4 @@
import { RiBarChartBoxLine } from "@remixicon/react";
import { RiBarChartBoxLine, RiExternalLinkLine } from "@remixicon/react";
import Image from "next/image";
import Link from "next/link";
import {
@@ -85,11 +85,11 @@ export function MyAccountsWidget({
src={logoSrc}
alt={`Logo da conta ${account.name}`}
fill
className="object-contain rounded-lg"
className="object-contain rounded-full"
/>
</div>
) : (
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-secondary text-sm font-semibold uppercase text-secondary-foreground">
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-secondary text-sm font-semibold uppercase text-secondary-foreground">
{initials}
</div>
)}
@@ -100,9 +100,13 @@ export function MyAccountsWidget({
href={`/contas/${
account.id
}/extrato?periodo=${formatPeriodForUrl(period)}`}
className="truncate font-medium text-foreground hover:text-primary hover:underline"
className="inline-flex max-w-full items-center gap-1 text-sm font-medium text-foreground underline-offset-2 hover:text-primary hover:underline"
>
<span className="truncate text-sm">{account.name}</span>
<span className="truncate">{account.name}</span>
<RiExternalLinkLine
className="size-3 shrink-0 text-muted-foreground"
aria-hidden
/>
</Link>
<div className="flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
<span className="truncate">{account.accountType}</span>

View File

@@ -65,7 +65,9 @@ export function PagadoresWidget({ pagadores }: PagadoresWidgetProps) {
href={`/pagadores/${pagador.id}`}
className="inline-flex max-w-full items-center gap-1 text-sm text-foreground underline-offset-2 hover:text-primary hover:underline"
>
<span className="truncate">{pagador.name}</span>
<span className="truncate font-medium">
{pagador.name}
</span>
{pagador.isAdmin && (
<RiVerifiedBadgeFill
className="size-4 shrink-0 text-blue-500"

View File

@@ -15,7 +15,7 @@ type PaymentConditionsWidgetProps = {
};
const CONDITION_ICON_CLASSES =
"flex size-9.5 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground";
"flex size-9.5 shrink-0 items-center justify-center rounded-full bg-muted text-foreground";
const CONDITION_ICONS: Record<string, ReactNode> = {
"À vista": <RiCheckLine className="size-5" aria-hidden />,

View File

@@ -10,7 +10,7 @@ type PaymentMethodsWidgetProps = {
};
const ICON_WRAPPER_CLASS =
"flex size-9.5 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground";
"flex size-9.5 shrink-0 items-center justify-center rounded-full bg-muted text-foreground";
const formatPercentage = (value: number) =>
new Intl.NumberFormat("pt-BR", {

View File

@@ -194,7 +194,7 @@ export function InvoiceSummaryCard({
<CardHeader className="flex flex-col gap-3">
<div className="flex items-start gap-3">
{logoPath ? (
<div className="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border/60 bg-background">
<div className="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border/60 bg-background">
<Image
src={logoPath}
alt={`Logo do cartão ${cardName}`}
@@ -204,7 +204,7 @@ export function InvoiceSummaryCard({
/>
</div>
) : cardBrand ? (
<span className="flex size-12 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-background text-sm font-semibold text-muted-foreground">
<span className="flex size-12 shrink-0 items-center justify-center rounded-full border border-border/60 bg-background text-sm font-semibold text-muted-foreground">
{cardBrand}
</span>
) : null}
@@ -270,7 +270,7 @@ export function InvoiceSummaryCard({
alt={`Bandeira ${cardBrand}`}
width={32}
height={32}
className="h-5 w-auto rounded"
className="h-5 w-auto rounded-full"
/>
<span className="truncate">{cardBrand}</span>
</div>

View File

@@ -109,7 +109,7 @@ export function ContaCartaoSelectContent({
alt={`Logo de ${label}`}
width={20}
height={20}
className="rounded"
className="rounded-full"
/>
) : (
<Icon className="size-4 text-muted-foreground" aria-hidden />

View File

@@ -54,7 +54,7 @@ export function EstabelecimentoLogo({
return (
<div
className={cn(
"flex items-center justify-center rounded-lg text-white font-bold shrink-0",
"flex items-center justify-center rounded-full text-white font-bold shrink-0",
colorClass,
className,
)}

View File

@@ -447,7 +447,7 @@ const buildColumns = ({
alt={`Logo de ${label}`}
width={30}
height={30}
className="rounded-md"
className="rounded-full"
/>
)}
<span className="truncate">{label}</span>
@@ -478,7 +478,7 @@ const buildColumns = ({
alt={`Logo de ${label}`}
width={30}
height={30}
className="rounded-md"
className="rounded-full"
/>
)}
<span className="truncate">{label}</span>

View File

@@ -56,7 +56,7 @@ export function LogoPickerTrigger({
className,
)}
>
<span className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border/40 bg-background shadow-xs">
<span className="flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border/40 bg-background shadow-xs">
{selectedLogoPath ? (
<Image
src={selectedLogoPath}
@@ -165,13 +165,13 @@ export function LogoPickerDialog({
"border-primary bg-primary/5 ring-2 ring-primary/40",
)}
>
<span className="flex w-full items-center justify-center overflow-hidden rounded-md">
<span className="flex w-full items-center justify-center overflow-hidden rounded-full">
<Image
src={resolveLogoSrc(logo, basePath)}
alt={logoLabel || logo}
width={40}
height={40}
className="rounded-md"
className="rounded-full"
/>
</span>
<span className="line-clamp-1 text-[10px] leading-tight text-muted-foreground">

View File

@@ -51,7 +51,7 @@ export function PagadorCardUsageCard({ items }: PagadorCardUsageCardProps) {
>
<div className="flex items-center gap-3">
{logoPath ? (
<span className="flex size-10 items-center justify-center overflow-hidden rounded-lg border border-border/60 bg-background">
<span className="flex size-10 items-center justify-center overflow-hidden rounded-full border border-border/60 bg-background">
<Image
src={logoPath}
alt={`Logo ${item.name}`}
@@ -61,7 +61,7 @@ export function PagadorCardUsageCard({ items }: PagadorCardUsageCardProps) {
/>
</span>
) : (
<span className="flex size-10 items-center justify-center rounded-lg bg-muted text-xs font-semibold uppercase text-muted-foreground">
<span className="flex size-10 items-center justify-center rounded-full bg-muted text-xs font-semibold uppercase text-muted-foreground">
{item.name.slice(0, 2)}
</span>
)}

View File

@@ -1,6 +1,7 @@
import { RiBarcodeLine } from "@remixicon/react";
import MoneyValues from "@/components/money-values";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";
import { WidgetEmptyState } from "@/components/widget-empty-state";
import type { PagadorBoletoStats } from "@/lib/pagadores/details";
import { cn } from "@/lib/utils/ui";
@@ -43,7 +44,7 @@ export function PagadorBoletoCard({ stats }: PagadorBoletoCardProps) {
/>
</div>
<div className="space-y-2 rounded-xl border border-dashed p-3">
<div className="space-y-2 border rounded-lg p-3">
<StatusRow
label="Pagos"
amount={stats.paidAmount}
@@ -51,6 +52,7 @@ export function PagadorBoletoCard({ stats }: PagadorBoletoCardProps) {
percent={paidPercent}
tone="success"
/>
<Separator />
<StatusRow
label="Pendentes"
amount={stats.pendingAmount}
@@ -77,7 +79,7 @@ type StatusRowProps = {
function StatusRow({ label, amount, count, percent, tone }: StatusRowProps) {
const clampedPercent = Math.min(Math.max(percent, 0), 100);
return (
<div className="space-y-1 rounded-lg bg-muted/40 p-3">
<div className="space-y-1 rounded p-3">
<div className="flex items-center justify-between text-sm font-semibold">
<span>{label}</span>
<span className="text-muted-foreground">{count} registros</span>

View File

@@ -131,7 +131,7 @@ export function InboxCard({
alt=""
width={24}
height={24}
className="shrink-0 rounded-sm"
className="shrink-0 rounded-full"
/>
)}
{item.sourceAppName || item.sourceApp}

View File

@@ -55,7 +55,7 @@ export function CardTopExpenses({ data }: CardTopExpensesProps) {
<div className="flex items-center justify-between gap-3">
<div className="flex min-w-0 flex-1 items-center gap-2">
{/* Rank number */}
<div className="flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted">
<div className="flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted">
<span className="text-sm font-semibold text-muted-foreground">
{index + 1}
</span>

View File

@@ -94,7 +94,7 @@ export function CardUsageChart({ data, limit, card }: CardUsageChartProps) {
alt={card.name}
width={24}
height={24}
className="rounded object-contain"
className="rounded-full object-contain"
/>
) : (
<RiBankCard2Line className="size-5 text-muted-foreground" />

View File

@@ -140,7 +140,7 @@ export function CardsOverview({ data }: CardsOverviewProps) {
alt={card.name}
width={32}
height={32}
className="rounded-sm object-contain"
className="rounded-full object-contain"
/>
) : (
<RiBankCard2Line className="size-5 text-muted-foreground" />

View File

@@ -70,7 +70,7 @@ export function EstablishmentsList({
<div className="flex items-center justify-between gap-3">
<div className="flex min-w-0 flex-1 items-center gap-2">
{/* Rank number - same size as icon containers */}
<div className="flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted">
<div className="flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted">
<span className="text-sm font-semibold text-muted-foreground">
{index + 1}
</span>

View File

@@ -14,11 +14,8 @@ export function handleActionError(error: unknown): ActionResult {
return errorResult(error.issues[0]?.message ?? "Dados inválidos.");
}
if (error instanceof Error) {
return errorResult(error.message);
}
return errorResult("Erro inesperado.");
console.error("[ActionError]", error);
return errorResult("Ocorreu um erro inesperado. Tente novamente.");
}
/**

View File

@@ -1,7 +1,9 @@
import crypto from "node:crypto";
const JWT_SECRET =
process.env.BETTER_AUTH_SECRET || "opensheets-secret-change-me";
const JWT_SECRET = process.env.BETTER_AUTH_SECRET;
if (!JWT_SECRET) {
throw new Error("BETTER_AUTH_SECRET is required. Set it in your .env file.");
}
const ACCESS_TOKEN_EXPIRY = 7 * 24 * 60 * 60; // 7 days in seconds
const REFRESH_TOKEN_EXPIRY = 90 * 24 * 60 * 60; // 90 days in seconds

View File

@@ -11,6 +11,7 @@ const nextConfig: NextConfig = {
},
reactCompiler: true,
typescript: {
// TODO: Corrigir erros TS e remover. Erros pré-existentes em ~5 arquivos.
ignoreBuildErrors: true,
},
images: {
@@ -37,6 +38,18 @@ const nextConfig: NextConfig = {
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "Content-Security-Policy",
value: "frame-ancestors 'none';",
},
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=()",
},
],
},
];

View File

@@ -27,13 +27,13 @@
"docker:rebuild": "docker compose up --build --force-recreate"
},
"dependencies": {
"@ai-sdk/anthropic": "^3.0.37",
"@ai-sdk/google": "^3.0.21",
"@ai-sdk/openai": "^3.0.25",
"@ai-sdk/anthropic": "^3.0.44",
"@ai-sdk/google": "^3.0.29",
"@ai-sdk/openai": "^3.0.29",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@openrouter/ai-sdk-provider": "^2.1.1",
"@openrouter/ai-sdk-provider": "^2.2.3",
"@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-alert-dialog": "1.1.15",
"@radix-ui/react-avatar": "1.1.11",
@@ -59,7 +59,7 @@
"@tanstack/react-table": "8.21.3",
"@vercel/analytics": "^1.6.1",
"@vercel/speed-insights": "^1.3.1",
"ai": "^6.0.73",
"ai": "^6.0.86",
"babel-plugin-react-compiler": "^1.0.0",
"better-auth": "1.4.18",
"class-variance-authority": "0.7.1",
@@ -73,25 +73,25 @@
"next-themes": "0.4.6",
"pg": "8.18.0",
"react": "19.2.4",
"react-day-picker": "^9.13.0",
"react-day-picker": "^9.13.2",
"react-dom": "19.2.4",
"recharts": "3.7.0",
"resend": "^6.9.1",
"resend": "^6.9.2",
"sonner": "2.0.7",
"tailwind-merge": "3.4.0",
"tailwind-merge": "3.4.1",
"vaul": "1.1.2",
"xlsx": "^0.18.5",
"zod": "4.3.6"
},
"devDependencies": {
"@biomejs/biome": "2.3.14",
"@biomejs/biome": "2.4.0",
"@tailwindcss/postcss": "4.1.18",
"@types/node": "25.2.1",
"@types/node": "25.2.3",
"@types/pg": "^8.16.0",
"@types/react": "19.2.13",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"dotenv": "^17.2.4",
"drizzle-kit": "0.31.8",
"dotenv": "^17.3.1",
"drizzle-kit": "0.31.9",
"tailwindcss": "4.1.18",
"tsx": "4.21.0",
"typescript": "5.9.3"

1257
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff