create-brainerce-store 1.4.1 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/index.js +1 -1
  2. package/messages/en.json +9 -1
  3. package/messages/he.json +9 -1
  4. package/package.json +1 -1
  5. package/templates/nextjs/base/src/app/account/page.tsx +8 -4
  6. package/templates/nextjs/base/src/app/auth/callback/page.tsx +90 -90
  7. package/templates/nextjs/base/src/app/cart/page.tsx +110 -110
  8. package/templates/nextjs/base/src/app/checkout/page.tsx +614 -614
  9. package/templates/nextjs/base/src/app/login/page.tsx +58 -58
  10. package/templates/nextjs/base/src/app/order-confirmation/page.tsx +193 -193
  11. package/templates/nextjs/base/src/app/page.tsx +98 -98
  12. package/templates/nextjs/base/src/app/products/[slug]/page.tsx +435 -435
  13. package/templates/nextjs/base/src/app/products/page.tsx +246 -246
  14. package/templates/nextjs/base/src/app/register/page.tsx +68 -68
  15. package/templates/nextjs/base/src/app/verify-email/page.tsx +293 -293
  16. package/templates/nextjs/base/src/components/account/order-history.tsx +198 -198
  17. package/templates/nextjs/base/src/components/account/profile-section.tsx +189 -40
  18. package/templates/nextjs/base/src/components/auth/login-form.tsx +94 -94
  19. package/templates/nextjs/base/src/components/auth/oauth-buttons.tsx +137 -137
  20. package/templates/nextjs/base/src/components/auth/register-form.tsx +184 -184
  21. package/templates/nextjs/base/src/components/cart/cart-item.tsx +153 -153
  22. package/templates/nextjs/base/src/components/cart/cart-summary.tsx +70 -70
  23. package/templates/nextjs/base/src/components/cart/coupon-input.tsx +134 -134
  24. package/templates/nextjs/base/src/components/cart/reservation-countdown.tsx +103 -103
  25. package/templates/nextjs/base/src/components/checkout/checkout-form.tsx +305 -305
  26. package/templates/nextjs/base/src/components/checkout/delivery-method-step.tsx +64 -64
  27. package/templates/nextjs/base/src/components/checkout/payment-step.tsx +350 -344
  28. package/templates/nextjs/base/src/components/checkout/pickup-step.tsx +199 -199
  29. package/templates/nextjs/base/src/components/checkout/shipping-step.tsx +110 -110
  30. package/templates/nextjs/base/src/components/checkout/tax-display.tsx +65 -65
  31. package/templates/nextjs/base/src/components/layout/footer.tsx +38 -38
  32. package/templates/nextjs/base/src/components/layout/header.tsx +332 -332
  33. package/templates/nextjs/base/src/components/products/product-card.tsx +96 -96
  34. package/templates/nextjs/base/src/components/products/product-grid.tsx +35 -35
  35. package/templates/nextjs/base/src/components/shared/loading-spinner.tsx +32 -32
  36. package/templates/nextjs/base/src/lib/translations.ts +11 -11
  37. package/templates/nextjs/base/src/providers/store-provider.tsx.ejs +5 -1
@@ -1,65 +1,65 @@
1
- 'use client';
2
-
3
- import type { TaxBreakdown } from 'brainerce';
4
- import { formatPrice } from 'brainerce';
5
- import { useTranslations } from '@/lib/translations';
6
- import { useStoreInfo } from '@/providers/store-provider';
7
- import { cn } from '@/lib/utils';
8
-
9
- interface TaxDisplayProps {
10
- /** Whether shipping address has been set */
11
- addressSet: boolean;
12
- /** Tax amount string from checkout (only available after address is set) */
13
- taxAmount?: string;
14
- /** Detailed tax breakdown (optional) */
15
- taxBreakdown?: TaxBreakdown | null;
16
- className?: string;
17
- }
18
-
19
- export function TaxDisplay({ addressSet, taxAmount, taxBreakdown, className }: TaxDisplayProps) {
20
- const t = useTranslations('checkout');
21
- const tc = useTranslations('common');
22
- const { storeInfo } = useStoreInfo();
23
- const currency = storeInfo?.currency || 'USD';
24
-
25
- // Before address is set
26
- if (!addressSet) {
27
- return (
28
- <div className={cn('flex items-center justify-between text-sm', className)}>
29
- <span className="text-muted-foreground">{tc('tax')}</span>
30
- <span className="text-muted-foreground text-xs">{t('calculatedAfterAddress')}</span>
31
- </div>
32
- );
33
- }
34
-
35
- // After address, show tax amount
36
- const tax = taxAmount ? parseFloat(taxAmount) : 0;
37
-
38
- return (
39
- <div className={cn('space-y-1', className)}>
40
- <div className="flex items-center justify-between text-sm">
41
- <span className="text-muted-foreground">{tc('tax')}</span>
42
- <span className="text-foreground font-medium">
43
- {tax > 0 ? (formatPrice(tax, { currency }) as string) : t('noTax')}
44
- </span>
45
- </div>
46
-
47
- {/* Tax breakdown details */}
48
- {taxBreakdown && taxBreakdown.breakdown?.length > 0 && tax > 0 && (
49
- <div className="space-y-0.5 ps-4">
50
- {taxBreakdown.breakdown.map((item, index) => (
51
- <div
52
- key={index}
53
- className="text-muted-foreground flex items-center justify-between text-xs"
54
- >
55
- <span>
56
- {item.name} ({(item.rate * 100).toFixed(1)}%)
57
- </span>
58
- <span>{formatPrice(item.amount, { currency }) as string}</span>
59
- </div>
60
- ))}
61
- </div>
62
- )}
63
- </div>
64
- );
65
- }
1
+ 'use client';
2
+
3
+ import type { TaxBreakdown } from 'brainerce';
4
+ import { formatPrice } from 'brainerce';
5
+ import { useTranslations } from '@/lib/translations';
6
+ import { useStoreInfo } from '@/providers/store-provider';
7
+ import { cn } from '@/lib/utils';
8
+
9
+ interface TaxDisplayProps {
10
+ /** Whether shipping address has been set */
11
+ addressSet: boolean;
12
+ /** Tax amount string from checkout (only available after address is set) */
13
+ taxAmount?: string;
14
+ /** Detailed tax breakdown (optional) */
15
+ taxBreakdown?: TaxBreakdown | null;
16
+ className?: string;
17
+ }
18
+
19
+ export function TaxDisplay({ addressSet, taxAmount, taxBreakdown, className }: TaxDisplayProps) {
20
+ const t = useTranslations('checkout');
21
+ const tc = useTranslations('common');
22
+ const { storeInfo } = useStoreInfo();
23
+ const currency = storeInfo?.currency || 'USD';
24
+
25
+ // Before address is set
26
+ if (!addressSet) {
27
+ return (
28
+ <div className={cn('flex items-center justify-between text-sm', className)}>
29
+ <span className="text-muted-foreground">{tc('tax')}</span>
30
+ <span className="text-muted-foreground text-xs">{t('calculatedAfterAddress')}</span>
31
+ </div>
32
+ );
33
+ }
34
+
35
+ // After address, show tax amount
36
+ const tax = taxAmount ? parseFloat(taxAmount) : 0;
37
+
38
+ return (
39
+ <div className={cn('space-y-1', className)}>
40
+ <div className="flex items-center justify-between text-sm">
41
+ <span className="text-muted-foreground">{tc('tax')}</span>
42
+ <span className="text-foreground font-medium">
43
+ {tax > 0 ? (formatPrice(tax, { currency }) as string) : t('noTax')}
44
+ </span>
45
+ </div>
46
+
47
+ {/* Tax breakdown details */}
48
+ {taxBreakdown && taxBreakdown.breakdown?.length > 0 && tax > 0 && (
49
+ <div className="space-y-0.5 ps-4">
50
+ {taxBreakdown.breakdown.map((item, index) => (
51
+ <div
52
+ key={index}
53
+ className="text-muted-foreground flex items-center justify-between text-xs"
54
+ >
55
+ <span>
56
+ {item.name} ({(item.rate * 100).toFixed(1)}%)
57
+ </span>
58
+ <span>{formatPrice(item.amount, { currency }) as string}</span>
59
+ </div>
60
+ ))}
61
+ </div>
62
+ )}
63
+ </div>
64
+ );
65
+ }
@@ -1,38 +1,38 @@
1
- 'use client';
2
-
3
- import Link from 'next/link';
4
- import { useTranslations } from '@/lib/translations';
5
- import { useStoreInfo } from '@/providers/store-provider';
6
-
7
- export function Footer() {
8
- const t = useTranslations('common');
9
- const tn = useTranslations('nav');
10
- const { storeInfo } = useStoreInfo();
11
- const year = new Date().getFullYear();
12
-
13
- return (
14
- <footer className="border-border bg-background border-t">
15
- <div className="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
16
- <div className="flex flex-col items-center justify-between gap-4 sm:flex-row">
17
- <p className="text-muted-foreground text-sm">
18
- {year} {storeInfo?.name || t('store')}. {t('allRightsReserved')}
19
- </p>
20
- <nav className="flex items-center gap-4">
21
- <Link
22
- href="/products"
23
- className="text-muted-foreground hover:text-foreground text-sm transition-colors"
24
- >
25
- {tn('products')}
26
- </Link>
27
- <Link
28
- href="/account"
29
- className="text-muted-foreground hover:text-foreground text-sm transition-colors"
30
- >
31
- {tn('account')}
32
- </Link>
33
- </nav>
34
- </div>
35
- </div>
36
- </footer>
37
- );
38
- }
1
+ 'use client';
2
+
3
+ import Link from 'next/link';
4
+ import { useTranslations } from '@/lib/translations';
5
+ import { useStoreInfo } from '@/providers/store-provider';
6
+
7
+ export function Footer() {
8
+ const t = useTranslations('common');
9
+ const tn = useTranslations('nav');
10
+ const { storeInfo } = useStoreInfo();
11
+ const year = new Date().getFullYear();
12
+
13
+ return (
14
+ <footer className="border-border bg-background border-t">
15
+ <div className="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
16
+ <div className="flex flex-col items-center justify-between gap-4 sm:flex-row">
17
+ <p className="text-muted-foreground text-sm">
18
+ {year} {storeInfo?.name || t('store')}. {t('allRightsReserved')}
19
+ </p>
20
+ <nav className="flex items-center gap-4">
21
+ <Link
22
+ href="/products"
23
+ className="text-muted-foreground hover:text-foreground text-sm transition-colors"
24
+ >
25
+ {tn('products')}
26
+ </Link>
27
+ <Link
28
+ href="/account"
29
+ className="text-muted-foreground hover:text-foreground text-sm transition-colors"
30
+ >
31
+ {tn('account')}
32
+ </Link>
33
+ </nav>
34
+ </div>
35
+ </div>
36
+ </footer>
37
+ );
38
+ }