Add/white label (#381)
* feat(branding): add BrandingService with default-preserving env layer Introduce lib/branding/service.ts mirroring lib/email/service.ts. Defaults match current gnubok values exactly, so production behaviour is unchanged unless an env var (NEXT_PUBLIC_BRANDING_*, BRANDING_*) or extension override (via registerBrandingService) is set. Resolution order: defaults < env vars < extension override. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(branding): route root layout, manifest, and PWA assets through branding service - app/layout.tsx now reads title, description, themeColor, and apple-touch-icon from getBranding() instead of hardcoded values. - public/manifest.json replaced by dynamic app/manifest.ts so PWA name, short_name, description, theme_color, background_color, and icon paths are resolved at request time. The manifest now serves at /manifest.webmanifest (Next.js convention for the metadata file route). The previous /manifest.json URL is no longer populated; nothing in core references it after this commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(branding): route email service and templates through branding service - resend-service.ts: From line uses getBranding().appName instead of hardcoded "Gnubok" in both the with-fromName and bare cases. - invite-templates.ts: subject, HTML header, body, plain text, and the team-invite variants all read from branding (sentence case in prose, uppercased for the styled <p> header). - consent-notification-templates.ts: signature fallback (companyName || branding) for both HTML and plain text variants. Defaults preserve the exact current strings ("Gnubok", "GNUBOK", "gnubok" in their respective contexts) so no email content changes for production. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(branding): route OAuth consent page through branding service The MCP OAuth consent page rendered for Claude Desktop / Claude.ai connector flows now reads the app name from getBranding() for both the HTML <title> and the body copy. Default still produces "gnubok" in lowercase prose, matching current behaviour. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(branding): route auth, dashboard, and onboarding text through branding service Replace user-visible "gnubok" / "Gnubok" references with calls to getBranding(). Touches: - Auth pages (login, register, mfa/enroll): logo src/alt, MFA TOTP friendlyName. - Onboarding (companies/new, invite, sandbox, WelcomeOnboarding, Step2CompanyDetails, NewUserChecklist, BankIdCompanyPicker, ArcimMigrationWorkspace): logo, headings, error/help text. - Dashboard fallback (companyName="gnubok") and settings (backup copy, ApiKeysPanel MCP connector name + login note, CompanyDangerZone, retention-notice). - API routes (support contact subject prefix, enable-banking consent email companyName fallback, AI inbox receipt-request appUrl, pain001 messageId prefix). - MCP server "open the gnubok web app" review message. - Salary/reports filings (AGI Programnamn, KU10 Programnamn, payslip footer, full-archive system metadata, SRU #PROGRAM line). Internal identifiers (cookie names gnubok-company-id / gnubok-invite-token, API key prefix gnubok_sk_, invite token prefix gnubok_inv_, MCP tool names, npm package gnubok-mcp, GNUBOK_API_KEY env name) are deliberately left unchanged — they're stable contracts that whitelabels must not break. Defaults match current behaviour exactly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(branding): support legal page field-level swaps for entity and contact Privacy and DPA pages now interpolate appName, legalEntity, and privacyEmail from the branding service instead of hardcoding "Gnubok", "Arcim", and "privacy@gnubok.se". Page metadata uses generateMetadata() so titles also reflect the brand. lib/support.ts now falls back to getBranding().supportEmail when SUPPORT_RECIPIENT_EMAIL is unset, so a single BRANDING_SUPPORT_EMAIL env var configures both the support form recipient and the displayed support address. Whitelabels with a different legal jurisdiction or entirely different DPA text should override the page route from an extension. Phase 1 intentionally only supports field-level swaps. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(branding): add WHITELABEL.md and example branding extension WHITELABEL.md: fork checklist, env var reference, the "do not change" list (cookies, API key prefixes, invite token prefixes, MCP tool names, gnubok-mcp npm package, GNUBOK_API_KEY env name), out-of-scope items, the upstream sync workflow YAML to copy into a fork, conflict avoidance guidance, and a verification checklist. extensions/general/_example-branding/: copy-paste starter extension with index.ts (commented placeholder values for registerBrandingService), manifest.json, and README.md. Disabled by default (not added to extensions.config.json); whitelabels cp the folder, edit, and enable. sectors.test.ts: bumped expected extension count 12 -> 13 to account for the new starter extension on disk. The generated registry is unchanged because the example is disabled. The sync workflow YAML is documented inline in WHITELABEL.md rather than checked in as a workflow file. It's only meaningful in a fork -- gnubok itself has nothing to sync from. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(branding): address PR review — lazy support email + escape brand in HTML/XML Three issues from code review: P1 — lib/support.ts: SUPPORT_RECIPIENT_EMAIL was a module-level const, evaluated at import time before extensions register branding overrides via ensureInitialized(). Convert to getSupportRecipientEmail() lazy accessor; update the only caller in app/api/support/contact/route.ts. Extension-supplied supportEmail values now route correctly. P2 — app/api/mcp-oauth/authorize/route.ts: appName was interpolated into the consent page HTML without escapeHtml(), inconsistent with the existing escaping of companyName. Wrap appName.toLowerCase() in escapeHtml() at use sites in <title> and the body paragraph. P2 — lib/salary/agi/xml-generator.ts and lib/salary/ku/ku10-generator.ts: appName placed inside <gem:Programnamn> / <Programnamn> XML elements without escapeXml(), the helper already used for other admin-controlled fields in the same files. Wrap accordingly to prevent malformed XML if a brand name contains XML reserved characters. All admin-controlled inputs only — no user-exploitable path. Defense in depth, not a known incident. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(branding): security follow-up — lazy metadata, SRU/email header sanitization Self-audit after the PR review surfaced four more concerns. Fixes them with the same defense-in-depth posture as the prior review fixes. 1. app/layout.tsx — same eager-evaluation class as P1 support.ts. The module-level `const branding = getBranding()` froze branding before extensions registered, so extension-based overrides for title, description, themeColor, and apple-touch-icon silently never applied. - Convert to generateMetadata() / generateViewport() (lazy, run per request, see extension-registered overrides). - Inline getBranding() inside RootLayout for the apple-touch-icon href so it picks up overrides too. - Add ensureInitialized() at module level so extensions are loaded before the first metadata call. Mirrors the API route pattern. 2. app/manifest.ts — same class. The dynamic manifest function reads getBranding() per request, but if the manifest is requested before any other module has triggered ensureInitialized(), extensions are still unloaded. Add ensureInitialized() at module level. 3. lib/reports/ink2/sru-generator.ts — appName interpolated into the SRU `#PROGRAM` directive without sanitization. SRU's reserved char is `#` (directive marker) and CRLF injects new directives. Wrap in the existing sanitizeString() helper to match the pattern used for other admin-controlled fields in this file (#NAMN, #ADRESS, etc.). 4. extensions/general/email/lib/resend-service.ts — appName and the user-controlled fromName both flow into the From header. Resend's API does its own validation, but defense in depth: strip CRLF and angle brackets via a small sanitizeHeaderPart() helper before building the header string. fromName was a pre-existing surface; appName is new with this whitelabel work. All four are admin-controlled inputs (env vars or extension code), not user-exploitable. No known incidents — defense in depth, and correctness for extension-based whitelabels. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
2d36dedf34
commit
064fb7f7a9
@@ -13,6 +13,9 @@ import Image from 'next/image'
|
||||
import { getErrorMessage } from '@/lib/errors/get-error-message'
|
||||
import { isBankIdEnabled } from '@/lib/auth/bankid'
|
||||
import { BankIdAuth } from '@/components/auth/BankIdAuth'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
const branding = getBranding()
|
||||
import type { BankIdResult } from '@/components/auth/BankIdAuth'
|
||||
|
||||
export default function LoginPage() {
|
||||
@@ -335,8 +338,8 @@ export default function LoginPage() {
|
||||
<div className="w-full max-w-sm animate-slide-up">
|
||||
<div className="text-center mb-10">
|
||||
<Image
|
||||
src="/gnubokiceon-removebg-preview.png"
|
||||
alt="Gnubok"
|
||||
src={branding.logoPath}
|
||||
alt={branding.appName}
|
||||
width={240}
|
||||
height={240}
|
||||
className="mx-auto mb-2"
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { Loader2, ShieldCheck, Copy, Check, ArrowLeft } from 'lucide-react'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
export default function MfaEnrollPage() {
|
||||
return (
|
||||
@@ -50,7 +51,7 @@ function MfaEnrollContent() {
|
||||
|
||||
const { data, error } = await supabase.auth.mfa.enroll({
|
||||
factorType: 'totp',
|
||||
friendlyName: 'gnubok',
|
||||
friendlyName: getBranding().appName.toLowerCase(),
|
||||
})
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -14,6 +14,9 @@ import { getErrorMessage } from '@/lib/errors/get-error-message'
|
||||
import { isBankIdEnabled } from '@/lib/auth/bankid'
|
||||
import { BankIdAuth } from '@/components/auth/BankIdAuth'
|
||||
import type { BankIdResult } from '@/components/auth/BankIdAuth'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
const branding = getBranding()
|
||||
|
||||
export default function RegisterPage() {
|
||||
return (
|
||||
@@ -335,8 +338,8 @@ function RegisterPageContent() {
|
||||
<div className="w-full max-w-sm animate-slide-up">
|
||||
<div className="text-center mb-10">
|
||||
<Image
|
||||
src="/gnubokiceon-removebg-preview.png"
|
||||
alt="Gnubok"
|
||||
src={branding.logoPath}
|
||||
alt={branding.appName}
|
||||
width={240}
|
||||
height={240}
|
||||
className="mx-auto mb-2"
|
||||
|
||||
@@ -8,6 +8,7 @@ import { SandboxBanner } from '@/components/dashboard/SandboxBanner'
|
||||
import { getExtensionNavItems } from '@/lib/extensions/sectors'
|
||||
import { CompanyProvider } from '@/contexts/CompanyContext'
|
||||
import { getActiveCompanyId } from '@/lib/company/context'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
import type { EntityType, CompanyRole, Team } from '@/types'
|
||||
|
||||
/**
|
||||
@@ -85,7 +86,7 @@ export default async function DashboardLayout({
|
||||
<CompanyTabSync />
|
||||
<div className="min-h-screen bg-background">
|
||||
<DashboardNav
|
||||
companyName="gnubok"
|
||||
companyName={getBranding().appName.toLowerCase()}
|
||||
entityType="enskild_firma"
|
||||
uncategorizedTransactionCount={0}
|
||||
pendingOperationsCount={0}
|
||||
@@ -136,7 +137,7 @@ export default async function DashboardLayout({
|
||||
<CompanyTabSync />
|
||||
<div className="min-h-screen bg-background">
|
||||
<DashboardNav
|
||||
companyName="gnubok"
|
||||
companyName={getBranding().appName.toLowerCase()}
|
||||
entityType="enskild_firma"
|
||||
uncategorizedTransactionCount={0}
|
||||
pendingOperationsCount={0}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { BackupDownloadForm } from '@/components/settings/BackupDownloadForm'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
export default function BackupSettingsPage() {
|
||||
const { appName } = getBranding()
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<section className="space-y-2">
|
||||
@@ -10,7 +12,7 @@ export default function BackupSettingsPage() {
|
||||
<p className="text-sm text-muted-foreground max-w-prose">
|
||||
Ladda ner en egen kopia av all räkenskapsinformation — SIE-filer, kvitton,
|
||||
underlag och behandlingshistorik — i en enda ZIP-fil. Säkerhetsbackupen är din
|
||||
egen kopia för trygghet och portabilitet. gnubok arkiverar all
|
||||
egen kopia för trygghet och portabilitet. {appName.toLowerCase()} arkiverar all
|
||||
räkenskapsinformation i minst 7 år enligt BFL 7 kap. 2 §, så din backup ersätter
|
||||
inte vårt lagkrav — den kompletterar det.
|
||||
</p>
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import type { Metadata } from 'next'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import Link from 'next/link'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Personuppgiftsbitradesavtal - Gnubok',
|
||||
export function generateMetadata(): Metadata {
|
||||
return {
|
||||
title: `Personuppgiftsbitradesavtal - ${getBranding().appName}`,
|
||||
}
|
||||
}
|
||||
|
||||
export default function DPAPage() {
|
||||
const { appName, legalEntity, privacyEmail } = getBranding()
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-b from-slate-50 to-white py-12 px-4">
|
||||
<div className="max-w-3xl mx-auto space-y-6">
|
||||
@@ -28,11 +32,11 @@ export default function DPAPage() {
|
||||
Detta personuppgiftsbitradesavtal ("DPA") ingår mellan:
|
||||
</p>
|
||||
<ul>
|
||||
<li><strong>Personuppgiftsansvarig ("den Ansvarige"):</strong> Du som användare av Gnubok,
|
||||
<li><strong>Personuppgiftsansvarig ("den Ansvarige"):</strong> Du som användare av {appName},
|
||||
i egenskap av ansvarig för de personuppgifter du registrerar i tjänsten
|
||||
(kunder, leverantörer, anställda m.fl.).</li>
|
||||
<li><strong>Personuppgiftsbiträde ("Biträdet"):</strong> Arcim, som tillhandahåller
|
||||
Gnubok-tjänsten och behandlar personuppgifter på dina vägnar.</li>
|
||||
<li><strong>Personuppgiftsbiträde ("Biträdet"):</strong> {legalEntity}, som tillhandahåller
|
||||
{' '}{appName}-tjänsten och behandlar personuppgifter på dina vägnar.</li>
|
||||
</ul>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -174,8 +178,8 @@ export default function DPAPage() {
|
||||
<CardContent className="pt-6">
|
||||
<p className="text-sm text-muted-foreground text-center">
|
||||
Detta personuppgiftsbitradesavtal träder i kraft när du skapar ett konto på
|
||||
Gnubok och gäller så länge du använder tjänsten. För frågor, kontakta oss
|
||||
på privacy@gnubok.se.
|
||||
{' '}{appName} och gäller så länge du använder tjänsten. För frågor, kontakta oss
|
||||
på {privacyEmail}.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import type { Metadata } from 'next'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Integritetspolicy - Gnubok',
|
||||
export function generateMetadata(): Metadata {
|
||||
return {
|
||||
title: `Integritetspolicy - ${getBranding().appName}`,
|
||||
}
|
||||
}
|
||||
|
||||
export default function PrivacyPolicyPage() {
|
||||
const { appName, legalEntity, privacyEmail } = getBranding()
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-b from-slate-50 to-white py-12 px-4">
|
||||
<div className="max-w-3xl mx-auto space-y-6">
|
||||
@@ -24,8 +28,8 @@ export default function PrivacyPolicyPage() {
|
||||
</CardHeader>
|
||||
<CardContent className="prose prose-sm max-w-none">
|
||||
<p>
|
||||
Arcim ("vi", "oss") är personuppgiftsansvarig för behandlingen av dina
|
||||
personuppgifter i samband med användningen av Gnubok. Vi behandlar dina uppgifter i
|
||||
{legalEntity} ("vi", "oss") är personuppgiftsansvarig för behandlingen av dina
|
||||
personuppgifter i samband med användningen av {appName}. Vi behandlar dina uppgifter i
|
||||
enlighet med EU:s dataskyddsförordning (GDPR) och svensk dataskyddslagstiftning.
|
||||
</p>
|
||||
</CardContent>
|
||||
@@ -205,8 +209,8 @@ export default function PrivacyPolicyPage() {
|
||||
För frågor om behandlingen av dina personuppgifter, kontakta oss:
|
||||
</p>
|
||||
<ul>
|
||||
<li><strong>Företag:</strong> Arcim</li>
|
||||
<li><strong>E-post:</strong> privacy@gnubok.se</li>
|
||||
<li><strong>Företag:</strong> {legalEntity}</li>
|
||||
<li><strong>E-post:</strong> {privacyEmail}</li>
|
||||
</ul>
|
||||
<p>
|
||||
Du har även rätt att lämna klagomål till Integritetsskyddsmyndigheten (IMY),
|
||||
|
||||
@@ -6,6 +6,7 @@ import { requireWritePermission } from '@/lib/auth/require-write'
|
||||
import { getEmailService } from '@/lib/email/service'
|
||||
import { appendProcessingHistory } from '@/lib/processing-history/append'
|
||||
import { gateAgentInbox } from '@/lib/ai/feature-flag'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
import type { InvoiceInboxItem } from '@/types'
|
||||
|
||||
ensureInitialized()
|
||||
@@ -105,7 +106,7 @@ export async function POST(
|
||||
const currency = extracted?.receipt?.currency ?? 'SEK'
|
||||
const date = extracted?.receipt?.date ?? null
|
||||
|
||||
const appUrl = process.env.NEXT_PUBLIC_APP_URL ?? 'https://gnubok.se'
|
||||
const appUrl = getBranding().appUrl
|
||||
const deepLink = `${appUrl.replace(/\/$/, '')}/agent-inbox`
|
||||
|
||||
const subject = `[${companyName}] Kvittobild behövs för bokföring`
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from '@/lib/email/consent-notification-templates'
|
||||
import { ensureInitialized } from '@/lib/init'
|
||||
import { verifyCronSecret } from '@/lib/auth/cron'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
import type { StoredAccount } from '@/extensions/general/enable-banking/types'
|
||||
|
||||
ensureInitialized()
|
||||
@@ -298,7 +299,7 @@ async function sendConsentExpiryNotification(
|
||||
bankName: connection.bank_name as string,
|
||||
daysUntilExpiry: daysLeft,
|
||||
renewalUrl: `${baseUrl}/settings/banking`,
|
||||
companyName: companySettings?.company_name || 'gnubok',
|
||||
companyName: companySettings?.company_name || getBranding().appName.toLowerCase(),
|
||||
isExpired,
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { createClient } from '@/lib/supabase/server'
|
||||
import { NextResponse } from 'next/server'
|
||||
import { createAuthCode } from '@/lib/auth/oauth-codes'
|
||||
import { requireCompanyId } from '@/lib/company/context'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
/**
|
||||
* OAuth 2.0 Authorization Endpoint.
|
||||
@@ -100,6 +101,8 @@ export async function GET(request: Request) {
|
||||
|
||||
const companyName = settings?.trade_name || settings?.company_name || user.email
|
||||
|
||||
const appNameLower = escapeHtml(getBranding().appName.toLowerCase())
|
||||
|
||||
// Render consent page
|
||||
const html = `<!DOCTYPE html>
|
||||
<html lang="sv">
|
||||
@@ -107,7 +110,7 @@ export async function GET(request: Request) {
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="translate" content="no">
|
||||
<title>Anslut MCP-klient — gnubok</title>
|
||||
<title>Anslut MCP-klient — ${appNameLower}</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { font-family: system-ui, -apple-system, sans-serif; background: #fafafa; color: #111; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
|
||||
@@ -128,7 +131,7 @@ export async function GET(request: Request) {
|
||||
<body>
|
||||
<div class="card">
|
||||
<h1>Anslut MCP-klient</h1>
|
||||
<p>En extern applikation vill ansluta till ditt gnubok-konto.</p>
|
||||
<p>En extern applikation vill ansluta till ditt ${appNameLower}-konto.</p>
|
||||
<div class="account">${escapeHtml(companyName)}</div>
|
||||
<ul class="permissions">
|
||||
<li>Visa och kategorisera transaktioner</li>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { NextResponse } from 'next/server'
|
||||
import { ensureInitialized } from '@/lib/init'
|
||||
import { requireCompanyId } from '@/lib/company/context'
|
||||
import { generatePain001 } from '@/lib/salary/payment/pain001-generator'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
import type { Pain001CompanyData, Pain001Employee } from '@/lib/salary/payment/pain001-generator'
|
||||
|
||||
ensureInitialized()
|
||||
@@ -105,7 +106,7 @@ export async function GET(
|
||||
})
|
||||
|
||||
const periodLabel = `${run.period_year}-${String(run.period_month).padStart(2, '0')}`
|
||||
const messageId = `GNUBOK-${company.org_number?.replace('-', '')}-${periodLabel}`
|
||||
const messageId = `${getBranding().appName.toUpperCase()}-${company.org_number?.replace('-', '')}-${periodLabel}`
|
||||
|
||||
const xml = generatePain001(companyData, employees, {
|
||||
messageId,
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { createClient } from '@/lib/supabase/server'
|
||||
import { NextResponse } from 'next/server'
|
||||
import { getEmailService } from '@/lib/email/service'
|
||||
import { SUPPORT_RECIPIENT_EMAIL } from '@/lib/support'
|
||||
import { getSupportRecipientEmail } from '@/lib/support'
|
||||
import { requireCompanyId } from '@/lib/company/context'
|
||||
import { ensureInitialized } from '@/lib/init'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
ensureInitialized()
|
||||
|
||||
@@ -47,8 +48,8 @@ export async function POST(request: Request) {
|
||||
const safeMessage = escapeHtml(message).replace(/\n/g, '<br />')
|
||||
|
||||
const result = await emailService.sendEmail({
|
||||
to: SUPPORT_RECIPIENT_EMAIL,
|
||||
subject: `[gnubok support] ${subject}`,
|
||||
to: getSupportRecipientEmail(),
|
||||
subject: `[${getBranding().appName.toLowerCase()} support] ${subject}`,
|
||||
replyTo: user.email,
|
||||
html: `
|
||||
<p><strong>Från:</strong> ${escapeHtml(user.email || '')}</p>
|
||||
|
||||
@@ -13,6 +13,9 @@ import { cn } from '@/lib/utils'
|
||||
import { ENABLED_EXTENSION_IDS } from '@/lib/extensions/_generated/enabled-extensions'
|
||||
import type { CompanyLookupResult } from '@/lib/company-lookup/types'
|
||||
import type { CompanySettings, EntityType, MomsPeriod } from '@/types'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
const branding = getBranding()
|
||||
|
||||
import Step1EntityType from '@/components/onboarding/Step1EntityType'
|
||||
import Step2CompanyDetails from '@/components/onboarding/Step2CompanyDetails'
|
||||
@@ -229,13 +232,13 @@ function NewCompanyContent() {
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
</Link>
|
||||
<Image
|
||||
src="/gnubokiceon-removebg-preview.png"
|
||||
alt="Gnubok"
|
||||
src={branding.logoPath}
|
||||
alt={branding.appName}
|
||||
width={30}
|
||||
height={30}
|
||||
className="invert opacity-90"
|
||||
/>
|
||||
<span className="font-display text-base tracking-tight">gnubok</span>
|
||||
<span className="font-display text-base tracking-tight">{branding.appName.toLowerCase()}</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
{STEP_INFO.map((_, i) => {
|
||||
|
||||
@@ -9,6 +9,9 @@ import { Card } from '@/components/ui/card'
|
||||
import { Loader2, Building2, AlertCircle } from 'lucide-react'
|
||||
import { createClient } from '@/lib/supabase/client'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
const branding = getBranding()
|
||||
|
||||
interface InviteInfo {
|
||||
type: 'company'
|
||||
@@ -164,13 +167,13 @@ export default function InvitePage() {
|
||||
<div className="relative z-10 max-w-2xl mx-auto w-full px-6 md:px-10 pt-5 pb-6 md:pt-6 md:pb-8">
|
||||
<div className="flex items-center gap-2.5 mb-5 md:mb-6">
|
||||
<Image
|
||||
src="/gnubokiceon-removebg-preview.png"
|
||||
alt="Gnubok"
|
||||
src={branding.logoPath}
|
||||
alt={branding.appName}
|
||||
width={30}
|
||||
height={30}
|
||||
className="invert opacity-90"
|
||||
/>
|
||||
<span className="font-display text-base tracking-tight">gnubok</span>
|
||||
<span className="font-display text-base tracking-tight">{branding.appName.toLowerCase()}</span>
|
||||
</div>
|
||||
<div className="animate-fade-in">
|
||||
<h1 className="font-display text-2xl md:text-3xl font-medium tracking-tight leading-[1.1]">
|
||||
@@ -291,7 +294,7 @@ export default function InvitePage() {
|
||||
Du har bjudits in som medlem till detta företag.
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground mt-1">
|
||||
<strong>{invite.email}</strong> har redan ett konto på gnubok.
|
||||
<strong>{invite.email}</strong> har redan ett konto på {branding.appName.toLowerCase()}.
|
||||
Logga in för att gå med.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
+30
-17
@@ -4,8 +4,15 @@ import { Fraunces } from "next/font/google";
|
||||
import Script from "next/script";
|
||||
import { Toaster } from "@/components/ui/toaster";
|
||||
import { ThemeProvider } from "@/components/theme-provider";
|
||||
import { ensureInitialized } from "@/lib/init";
|
||||
import { getBranding } from "@/lib/branding/service";
|
||||
import "./globals.css";
|
||||
|
||||
// Load extensions before metadata/viewport functions read the branding service.
|
||||
// Without this, an extension that calls registerBrandingService() at its module
|
||||
// load time would not have run yet when the first request hits this layout.
|
||||
ensureInitialized();
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
@@ -22,34 +29,40 @@ const fraunces = Fraunces({
|
||||
display: "swap",
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Gnubok",
|
||||
description: "Ekonomihantering",
|
||||
manifest: "/manifest.json",
|
||||
appleWebApp: {
|
||||
capable: true,
|
||||
statusBarStyle: "default",
|
||||
title: "Gnubok",
|
||||
},
|
||||
};
|
||||
export function generateMetadata(): Metadata {
|
||||
const b = getBranding();
|
||||
return {
|
||||
title: b.appName,
|
||||
description: b.appDescription,
|
||||
manifest: "/manifest.webmanifest",
|
||||
appleWebApp: {
|
||||
capable: true,
|
||||
statusBarStyle: "default",
|
||||
title: b.appName,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export const viewport: Viewport = {
|
||||
themeColor: "#304D83",
|
||||
width: "device-width",
|
||||
initialScale: 1,
|
||||
viewportFit: "cover",
|
||||
};
|
||||
export function generateViewport(): Viewport {
|
||||
return {
|
||||
themeColor: getBranding().themeColor,
|
||||
width: "device-width",
|
||||
initialScale: 1,
|
||||
viewportFit: "cover",
|
||||
};
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const branding = getBranding();
|
||||
return (
|
||||
<html lang="sv" translate="no" suppressHydrationWarning className={`${geistSans.variable} ${geistMono.variable} ${fraunces.variable}`}>
|
||||
<head>
|
||||
<meta name="google" content="notranslate" />
|
||||
<link rel="apple-touch-icon" href="/icons/icon-192.png" />
|
||||
<link rel="apple-touch-icon" href={branding.appleTouchIconPath} />
|
||||
<script
|
||||
src="https://cdn.recapt.app/browser/glimt.js"
|
||||
async
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { MetadataRoute } from 'next'
|
||||
import { ensureInitialized } from '@/lib/init'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
// Guarantee branding extensions have registered before the manifest is built.
|
||||
ensureInitialized()
|
||||
|
||||
export default function manifest(): MetadataRoute.Manifest {
|
||||
const b = getBranding()
|
||||
const sizes = [72, 96, 128, 144, 152, 192, 384, 512]
|
||||
// Next.js's Icon type doesn't accept the space-separated "any maskable" purpose
|
||||
// that the original public/manifest.json used. Cast preserves the same JSON
|
||||
// output so PWA install prompts behave identically to before.
|
||||
const icons = sizes.map((size) => ({
|
||||
src: `${b.pwaIconBasePath}/icon-${size}.png`,
|
||||
sizes: `${size}x${size}`,
|
||||
type: 'image/png',
|
||||
purpose: 'any maskable',
|
||||
})) as unknown as MetadataRoute.Manifest['icons']
|
||||
return {
|
||||
name: b.appName,
|
||||
short_name: b.appName,
|
||||
description: b.appDescription,
|
||||
start_url: '/',
|
||||
display: 'standalone',
|
||||
background_color: b.manifestBackgroundColor,
|
||||
theme_color: b.manifestThemeColor,
|
||||
orientation: 'portrait-primary',
|
||||
icons,
|
||||
categories: ['business', 'finance', 'productivity'],
|
||||
lang: 'sv-SE',
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@ import { createClient } from '@/lib/supabase/client'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useToast } from '@/components/ui/use-toast'
|
||||
import { Loader2, Receipt, ArrowLeftRight, BookOpen, BarChart3 } from 'lucide-react'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
const branding = getBranding()
|
||||
|
||||
export default function SandboxPage() {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
@@ -79,8 +82,8 @@ export default function SandboxPage() {
|
||||
<div className="w-full max-w-sm animate-slide-up">
|
||||
<div className="text-center mb-10">
|
||||
<Image
|
||||
src="/gnubokiceon-removebg-preview.png"
|
||||
alt="Gnubok"
|
||||
src={branding.logoPath}
|
||||
alt={branding.appName}
|
||||
width={240}
|
||||
height={240}
|
||||
className="mx-auto mb-2"
|
||||
@@ -114,15 +117,15 @@ export default function SandboxPage() {
|
||||
<div className="w-full max-w-sm animate-slide-up">
|
||||
<div className="text-center mb-10">
|
||||
<Image
|
||||
src="/gnubokiceon-removebg-preview.png"
|
||||
alt="Gnubok"
|
||||
src={branding.logoPath}
|
||||
alt={branding.appName}
|
||||
width={240}
|
||||
height={240}
|
||||
className="mx-auto mb-2"
|
||||
priority
|
||||
/>
|
||||
<h1 className="text-xl font-medium tracking-tight mt-3">
|
||||
Testa gnubok utan att registrera dig
|
||||
Testa {branding.appName.toLowerCase()} utan att registrera dig
|
||||
</h1>
|
||||
<p className="text-muted-foreground text-sm mt-2 leading-relaxed">
|
||||
Utforska ett fullt demoföretag med riktig data — helt gratis.
|
||||
|
||||
Reference in New Issue
Block a user