chore: remove all unicode emojis project-wide and sanitize pdf text
This commit is contained in:
@@ -193,8 +193,9 @@ export default function CustomerDetailPage({ params }: { params: Promise<{ id: s
|
||||
</Button>
|
||||
) : (
|
||||
<div className="space-y-3 p-4 rounded-lg bg-red-500/10 border border-red-500/30">
|
||||
<p className="text-sm text-red-300 font-semibold">
|
||||
⚠️ Diese Aktion ist unwiderruflich. Alle personenbezogenen Daten werden überschrieben.
|
||||
<p className="text-sm text-red-300 font-semibold flex items-center gap-2">
|
||||
<AlertTriangle className="w-4 h-4 shrink-0 text-red-400" />
|
||||
<span>Diese Aktion ist unwiderruflich. Alle personenbezogenen Daten werden überschrieben.</span>
|
||||
</p>
|
||||
<div className="flex gap-3">
|
||||
<Button
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
import { usePathname } from "next/navigation";
|
||||
import { DemoWrapper } from "./DemoWrapper";
|
||||
|
||||
import { AlertTriangle } from "lucide-react";
|
||||
|
||||
interface HeaderWrapperProps {
|
||||
navbar: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
@@ -25,9 +27,10 @@ export function HeaderWrapper({ navbar, children }: HeaderWrapperProps) {
|
||||
<DemoWrapper>
|
||||
<div
|
||||
id="demo-banner"
|
||||
className="bg-amber-500/10 border-b border-amber-500/20 py-2 px-4 text-center text-xs text-amber-600 dark:text-amber-400 font-medium tracking-wide z-50"
|
||||
className="bg-amber-500/10 border-b border-amber-500/20 py-2 px-4 text-center text-xs text-amber-600 dark:text-amber-400 font-medium tracking-wide z-50 flex items-center justify-center gap-1.5"
|
||||
>
|
||||
⚠️ Dies ist eine **Demo-Webseite (Dummy-Shop)**. Es werden keine echten Bestellungen verarbeitet oder Zahlungen abgewickelt.
|
||||
<AlertTriangle className="w-3.5 h-3.5 shrink-0" />
|
||||
<span>Dies ist eine **Demo-Webseite (Dummy-Shop)**. Es werden keine echten Bestellungen verarbeitet oder Zahlungen abgewickelt.</span>
|
||||
</div>
|
||||
</DemoWrapper>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import { Plus, Trash2, X, PlusCircle } from 'lucide-react'
|
||||
import { Plus, Trash2, X, PlusCircle, CreditCard, RefreshCw } from 'lucide-react'
|
||||
import { createProduct, updateProduct } from '@/lib/actions/products'
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
@@ -288,9 +288,11 @@ export function CreateProductDialog({
|
||||
<FormLabel className="text-slate-900 dark:text-white">Abrechnungsmodell</FormLabel>
|
||||
<div className="grid grid-cols-2 gap-2 pt-1">
|
||||
{[
|
||||
{ value: 'one_time', label: 'Einmalig', icon: '💳' },
|
||||
{ value: 'monthly', label: 'Monatlich', icon: '🔄' },
|
||||
].map(opt => (
|
||||
{ value: 'one_time', label: 'Einmalig', icon: CreditCard },
|
||||
{ value: 'monthly', label: 'Monatlich', icon: RefreshCw },
|
||||
].map(opt => {
|
||||
const IconComponent = opt.icon;
|
||||
return (
|
||||
<button
|
||||
key={opt.value}
|
||||
type="button"
|
||||
@@ -301,10 +303,11 @@ export function CreateProductDialog({
|
||||
: 'border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-white/5 text-slate-500 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-white/10'
|
||||
}`}
|
||||
>
|
||||
<span className="text-lg">{opt.icon}</span>
|
||||
<IconComponent className="w-5 h-5 mb-1" />
|
||||
{opt.label}
|
||||
</button>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
||||
@@ -94,6 +94,14 @@ const styles = StyleSheet.create({
|
||||
}
|
||||
});
|
||||
|
||||
export const stripEmojis = (text?: string | null): string => {
|
||||
if (!text) return '';
|
||||
return text
|
||||
.replace(/[\p{Emoji_Presentation}\p{Extended_Pictographic}\uFE0F\u200D]/gu, '')
|
||||
.replace(/\s{2,}/g, ' ')
|
||||
.trim();
|
||||
};
|
||||
|
||||
export const InvoicePDF = ({
|
||||
order,
|
||||
orderSnapshot,
|
||||
@@ -105,7 +113,7 @@ export const InvoicePDF = ({
|
||||
const items = orderSnapshot?.items ?? [];
|
||||
const taxRate = orderSnapshot?.tax_rate ?? 19;
|
||||
const isSubscription = order?.type === 'subscription' || orderSnapshot?.billing_cycle === 'monthly';
|
||||
const formattedOrderNumber = (order.order_number || order.id || '').replace(/^BE-/, 'AE-');
|
||||
const formattedOrderNumber = stripEmojis((order.order_number || order.id || '').replace(/^BE-/, 'AE-'));
|
||||
const isUpgrade = !!orderSnapshot?.last_license_date;
|
||||
|
||||
let oneTimeNet = 0;
|
||||
@@ -136,16 +144,16 @@ export const InvoicePDF = ({
|
||||
|
||||
const groupedItems: { [key: string]: any[] } = {};
|
||||
items.forEach((item: any) => {
|
||||
const devName = item.device_name || 'Kasse 1';
|
||||
const devName = stripEmojis(item.device_name || 'Kasse 1');
|
||||
if (!groupedItems[devName]) {
|
||||
groupedItems[devName] = [];
|
||||
}
|
||||
groupedItems[devName].push(item);
|
||||
});
|
||||
|
||||
const displayPartnerName = partnerCompanyName || order?.partner_company_name;
|
||||
const displayUserName = partnerUserName || order?.partner_user_name;
|
||||
const displayUserEmail = partnerUserEmail || order?.partner_user_email;
|
||||
const displayPartnerName = stripEmojis(partnerCompanyName || order?.partner_company_name);
|
||||
const displayUserName = stripEmojis(partnerUserName || order?.partner_user_name);
|
||||
const displayUserEmail = stripEmojis(partnerUserEmail || order?.partner_user_email);
|
||||
|
||||
return (
|
||||
<Document>
|
||||
@@ -170,11 +178,11 @@ export const InvoicePDF = ({
|
||||
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 15 }}>
|
||||
<View style={{ width: '48%' }}>
|
||||
<Text style={styles.label}>Endkunde</Text>
|
||||
<Text style={{ fontWeight: 'bold' }}>{customer.company_name}</Text>
|
||||
{customer.first_name || customer.last_name ? <Text>{customer.first_name} {customer.last_name}</Text> : null}
|
||||
{customer.address ? <Text>{customer.address}</Text> : null}
|
||||
{customer.zip_code || customer.city ? <Text>{customer.zip_code} {customer.city}</Text> : null}
|
||||
{customer.vat_id ? <Text>USt-IdNr: {customer.vat_id}</Text> : null}
|
||||
<Text style={{ fontWeight: 'bold' }}>{stripEmojis(customer?.company_name)}</Text>
|
||||
{(customer?.first_name || customer?.last_name) ? <Text>{stripEmojis(`${customer?.first_name || ''} ${customer?.last_name || ''}`)}</Text> : null}
|
||||
{customer?.address ? <Text>{stripEmojis(customer.address)}</Text> : null}
|
||||
{(customer?.zip_code || customer?.city) ? <Text>{stripEmojis(`${customer?.zip_code || ''} ${customer?.city || ''}`)}</Text> : null}
|
||||
{customer?.vat_id ? <Text>USt-IdNr: {stripEmojis(customer.vat_id)}</Text> : null}
|
||||
</View>
|
||||
|
||||
<View style={{ width: '48%' }}>
|
||||
@@ -205,8 +213,8 @@ export const InvoicePDF = ({
|
||||
{devItems.map((item: any, idx: number) => (
|
||||
<View key={idx} style={{ marginBottom: 6 }}>
|
||||
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 2 }}>
|
||||
<Text style={{ fontSize: 9, fontWeight: 'bold', color: '#334155' }}>
|
||||
{item.product_name} ({item.category_name})
|
||||
<Text style={{ fontSize: 9, fontWeight: 'bold', color: '#344155' }}>
|
||||
{stripEmojis(item.product_name)} ({stripEmojis(item.category_name)})
|
||||
</Text>
|
||||
<Text style={{ fontSize: 9, fontWeight: 'bold', color: '#0f172a' }}>
|
||||
{formattedPrice(item.base_price)} {item.billing_interval === 'one_time' ? 'einmalig' : 'mtl.'}
|
||||
@@ -218,7 +226,7 @@ export const InvoicePDF = ({
|
||||
return (
|
||||
<View key={mIdx} style={{ flexDirection: 'row', justifyContent: 'space-between', paddingLeft: 12, marginBottom: 1 }}>
|
||||
<Text style={{ fontSize: 8, color: '#64748b' }}>
|
||||
+ {mod.module_name} {qty > 1 ? `(x${qty})` : ''}
|
||||
+ {stripEmojis(mod.module_name)} {qty > 1 ? `(x${qty})` : ''}
|
||||
</Text>
|
||||
<Text style={{ fontSize: 8, color: '#64748b' }}>
|
||||
+{formattedPrice(price)} mtl.
|
||||
|
||||
@@ -16,6 +16,7 @@ import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState, useEffect, useRef, useCallback } from "react";
|
||||
import { motion, AnimatePresence } from "framer-motion";
|
||||
import { Ban } from "lucide-react";
|
||||
|
||||
function getDeviceHash(): string {
|
||||
const key = "caspos-device-id";
|
||||
@@ -227,8 +228,9 @@ export function LoginForm({
|
||||
/>
|
||||
</div>
|
||||
{errorParam === "gesperrt" && (
|
||||
<p className="text-sm text-red-500 bg-red-500/10 border border-red-500/20 p-3 rounded-lg text-center font-medium">
|
||||
🚫 Ihr Konto wurde gesperrt. Bitte wenden Sie sich an den Administrator.
|
||||
<p className="text-sm text-red-500 bg-red-500/10 border border-red-500/20 p-3 rounded-lg text-center font-medium flex items-center justify-center gap-2">
|
||||
<Ban className="w-4 h-4 shrink-0" />
|
||||
<span>Ihr Konto wurde gesperrt. Bitte wenden Sie sich an den Administrator.</span>
|
||||
</p>
|
||||
)}
|
||||
{messageParam === "concurrent" && (
|
||||
|
||||
@@ -8,7 +8,7 @@ import { submitOrder, updateOrder } from '@/lib/actions/orders'
|
||||
import { createEndCustomer } from '@/lib/actions/end-customers'
|
||||
import { isLicenseNumberTaken } from '@/lib/actions/queries'
|
||||
import { Category } from '@/lib/types'
|
||||
import { Check } from 'lucide-react'
|
||||
import { Check, Zap } from 'lucide-react'
|
||||
|
||||
// Modular Step Components
|
||||
import { ProgressStepper } from './wizard/progress-stepper'
|
||||
@@ -991,8 +991,8 @@ export function OrderWizard({
|
||||
</div>
|
||||
|
||||
{hasSelection ? (
|
||||
<span className="text-[9px] px-1.5 py-0.2 rounded-full font-semibold shrink-0 border border-emerald-500/30 text-emerald-400 bg-emerald-500/10">
|
||||
✓
|
||||
<span className="text-[9px] px-1.5 py-0.5 rounded-full font-semibold shrink-0 border border-emerald-500/30 text-emerald-400 bg-emerald-500/10 flex items-center justify-center">
|
||||
<Check className="w-2.5 h-2.5" />
|
||||
</span>
|
||||
) : isRequired ? (
|
||||
<span className="text-[9px] px-1.5 py-0.2 rounded-full font-extrabold shrink-0 border border-red-500 text-red-400 bg-red-500/20 animate-pulse tracking-wider">
|
||||
@@ -1079,7 +1079,7 @@ export function OrderWizard({
|
||||
{/* Upgrade-Modus Hinweis-Banner */}
|
||||
{upgradeMode && lockedDeviceId && (
|
||||
<div className="mb-4 p-3 rounded-xl bg-primary/10 border border-primary/20 text-xs text-primary/90 flex items-start gap-2">
|
||||
<span className="text-primary mt-0.5">⚡</span>
|
||||
<Zap className="w-4 h-4 text-primary shrink-0 mt-0.5" />
|
||||
<div>
|
||||
<p className="font-semibold">Upgrade-Modus: {lockedDeviceId}</p>
|
||||
<p className="text-primary/70 mt-0.5">Bereits lizenzierte Module sind ausgegraut und können nicht doppelt gebucht werden.</p>
|
||||
|
||||
@@ -156,7 +156,7 @@ export function FetchDataSteps() {
|
||||
</TutorialStep>
|
||||
|
||||
<TutorialStep title="Build in a weekend and scale to millions!">
|
||||
<p>You're ready to launch your product to the world! 🚀</p>
|
||||
<p>You're ready to launch your product to the world!</p>
|
||||
</TutorialStep>
|
||||
</ol>
|
||||
);
|
||||
|
||||
@@ -93,8 +93,8 @@ export function StepSoftware({
|
||||
|
||||
{editingDeviceName && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Badge className="bg-amber-500/20 text-amber-400 border border-amber-500/30 text-xs font-bold gap-1.5 px-2.5 py-0.5 rounded-lg animate-pulse shrink-0">
|
||||
✏️ Kasse: "{editingDeviceName}"
|
||||
<Badge className="bg-amber-500/20 text-amber-400 border border-amber-500/30 text-xs font-bold gap-1.5 px-2.5 py-0.5 rounded-lg animate-pulse shrink-0 flex items-center">
|
||||
<Icons.Pencil className="w-3 h-3 text-amber-400 mr-1" /> Kasse: "{editingDeviceName}"
|
||||
</Badge>
|
||||
{onCancelEdit && (
|
||||
<Button
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { motion, AnimatePresence } from 'framer-motion'
|
||||
import { AlertCircle } from 'lucide-react'
|
||||
import { AlertCircle, X } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
||||
interface ToastProps {
|
||||
@@ -31,7 +31,7 @@ export function ToastNotification({ toast, onClose }: ToastProps) {
|
||||
className="w-5 h-5 ml-auto text-slate-400 hover:text-white"
|
||||
onClick={onClose}
|
||||
>
|
||||
✕
|
||||
<X className="w-3.5 h-3.5" />
|
||||
</Button>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
@@ -158,17 +158,17 @@ function get2FAEmailHtml(code: string) {
|
||||
|
||||
<div style="background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-radius: 12px; padding: 16px 20px; margin: 24px 0; border-left: 4px solid #f59e0b;">
|
||||
<p style="color: #92400e; font-size: 14px; margin: 0; line-height: 1.5;">
|
||||
⏱️ <strong>Dieser Code ist 15 Minuten gültig.</strong><br>
|
||||
<strong>Dieser Code ist 15 Minuten gültig.</strong><br>
|
||||
Falls Sie diese Anmeldung nicht durchgeführt haben, ändern Sie bitte umgehend Ihr Passwort.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="color: #64748b; font-size: 13px; line-height: 1.6; margin-top: 24px;">
|
||||
🔒 Dieser Code dient der Sicherheit Ihres Kontos. Geben Sie ihn niemals an andere Personen weiter.
|
||||
Dieser Code dient der Sicherheit Ihres Kontos. Geben Sie ihn niemals an andere Personen weiter.
|
||||
</p>
|
||||
`
|
||||
|
||||
return getBeautifulEmailHtml('🔐 Sicherheitscode', messageHtml)
|
||||
return getBeautifulEmailHtml('Sicherheitscode', messageHtml)
|
||||
}
|
||||
|
||||
/** Internal: generates code + sends email (no auth check needed) */
|
||||
@@ -199,7 +199,7 @@ async function send2FACodeInternal(userId: string, deviceHash: string, email: st
|
||||
// Mail senden
|
||||
await sendMail({
|
||||
to: email,
|
||||
subject: '🔐 Ihr Sicherheitscode – CASPOS Shop',
|
||||
subject: 'Ihr Sicherheitscode – CASPOS Shop',
|
||||
text: `Ihr Sicherheitscode lautet: ${code}\n\nDieser Code ist 15 Minuten gültig.\n\nFalls Sie diese Anmeldung nicht durchgeführt haben, ändern Sie bitte umgehend Ihr Passwort.`,
|
||||
html: get2FAEmailHtml(code),
|
||||
})
|
||||
|
||||
@@ -144,7 +144,7 @@ export function getStatusEmailTemplate(
|
||||
? `
|
||||
<p style="text-align: center; margin: 32px 0 0 0;">
|
||||
<span style="display: inline-block; background-color: #1e293b; border: 1px solid #334155; border-radius: 6px; padding: 10px 20px; color: #3b82f6; font-size: 13px; font-weight: bold; letter-spacing: 0.025em;">
|
||||
📎 PDF im Anhang verfügbar
|
||||
PDF im Anhang verfügbar
|
||||
</span>
|
||||
</p>
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user