@caartzee/theme-sdk 0.0.0-stage → 1.0.0
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.
- package/README.md +34 -2
- package/dist/bin/caartzee-theme.js +7449 -0
- package/dist/lib/index.js +9838 -0
- package/dist/types/src/auth/credentials-store.d.ts +18 -0
- package/dist/types/src/auth/index.d.ts +2 -0
- package/dist/types/src/auth/oauth-client.d.ts +39 -0
- package/dist/types/src/blocks/block-contract.d.ts +242 -0
- package/dist/types/src/candy/compatibility-matrix.d.ts +10 -0
- package/dist/types/src/candy/context-builder.d.ts +31 -0
- package/dist/types/src/candy/engine.d.ts +69 -0
- package/dist/types/src/candy/filters.d.ts +32 -0
- package/dist/types/src/candy/ide-support.d.ts +20 -0
- package/dist/types/src/candy/index.d.ts +9 -0
- package/dist/types/src/candy/schema-parser.d.ts +13 -0
- package/dist/types/src/candy/security.d.ts +54 -0
- package/dist/types/src/candy/tags.d.ts +11 -0
- package/dist/types/src/candy/types.d.ts +185 -0
- package/dist/types/src/cli/caartzee-cli.d.ts +9 -0
- package/dist/types/src/cli/index.d.ts +1 -0
- package/dist/types/src/cli/sdk-client.d.ts +12 -0
- package/dist/types/src/contracts/category-selection.d.ts +15 -0
- package/dist/types/src/contracts/commerce.d.ts +282 -0
- package/dist/types/src/contracts/footer-builder.d.ts +125 -0
- package/dist/types/src/contracts/hooks.d.ts +37 -0
- package/dist/types/src/contracts/manifest.d.ts +3127 -0
- package/dist/types/src/contracts/navigation.d.ts +39 -0
- package/dist/types/src/contracts/order-tracking.d.ts +40 -0
- package/dist/types/src/contracts/page.d.ts +262 -0
- package/dist/types/src/contracts/storefront-content.d.ts +60 -0
- package/dist/types/src/contracts/style-document.d.ts +2 -0
- package/dist/types/src/contracts/styles.d.ts +2002 -0
- package/dist/types/src/contracts/theme.d.ts +35 -0
- package/dist/types/src/dev-server/catalog-preview.d.ts +25 -0
- package/dist/types/src/dev-server/dev-server.d.ts +22 -0
- package/dist/types/src/dev-server/index.d.ts +1 -0
- package/dist/types/src/dev-server/theme-preview.d.ts +4 -0
- package/dist/types/src/index.d.ts +27 -0
- package/dist/types/src/mock/index.d.ts +10 -0
- package/dist/types/src/mock/mock-categories.d.ts +2 -0
- package/dist/types/src/mock/mock-commerce.d.ts +55 -0
- package/dist/types/src/mock/mock-customer.d.ts +47 -0
- package/dist/types/src/mock/mock-hooks.d.ts +2 -0
- package/dist/types/src/mock/mock-products.d.ts +3 -0
- package/dist/types/src/rendering/commerce-pages.d.ts +16 -0
- package/dist/types/src/rendering/raw-html.d.ts +12 -0
- package/dist/types/src/rendering/section-wrapper.d.ts +30 -0
- package/dist/types/src/scaffold/candy-starter-assets.d.ts +2 -0
- package/dist/types/src/scaffold/commerce-generator.d.ts +3 -0
- package/dist/types/src/scaffold/index.d.ts +2 -0
- package/dist/types/src/scaffold/template-generator.d.ts +21 -0
- package/dist/types/src/sections/section-contract.d.ts +350 -0
- package/dist/types/src/settings/global-settings.d.ts +25 -0
- package/dist/types/src/templates/json-template.d.ts +991 -0
- package/dist/types/src/validation/package-validator.d.ts +53 -0
- package/dist/types/src/validation/rich-text.d.ts +24 -0
- package/package.json +28 -3
- package/templates/commerce/README.md +165 -0
- package/templates/commerce/assets/theme.css +1 -0
- package/templates/commerce/manifest.json +1 -0
- package/templates/commerce/src/blocks/index.ts +184 -0
- package/templates/commerce/src/config/settings-defaults.ts +25 -0
- package/templates/commerce/src/config/settings-schema.ts +102 -0
- package/templates/commerce/src/index.ts +90 -0
- package/templates/commerce/src/layouts/default.ts +275 -0
- package/templates/commerce/src/manifest.ts +976 -0
- package/templates/commerce/src/pages/account/components.ts +369 -0
- package/templates/commerce/src/pages/account/tabs.ts +792 -0
- package/templates/commerce/src/pages/account.ts +55 -0
- package/templates/commerce/src/pages/campaign.ts +423 -0
- package/templates/commerce/src/pages/cart.ts +261 -0
- package/templates/commerce/src/pages/category-detail.ts +124 -0
- package/templates/commerce/src/pages/category-list.ts +87 -0
- package/templates/commerce/src/pages/checkout.ts +712 -0
- package/templates/commerce/src/pages/commerce.ts +45 -0
- package/templates/commerce/src/pages/home.ts +160 -0
- package/templates/commerce/src/pages/index.ts +99 -0
- package/templates/commerce/src/pages/login.ts +204 -0
- package/templates/commerce/src/pages/order-success.ts +80 -0
- package/templates/commerce/src/pages/product-detail.ts +489 -0
- package/templates/commerce/src/pages/product-list.ts +125 -0
- package/templates/commerce/src/pages/search.ts +88 -0
- package/templates/commerce/src/pages/signup.ts +253 -0
- package/templates/commerce/src/pages/status.ts +7 -0
- package/templates/commerce/src/pages/theme-layout.ts +491 -0
- package/templates/commerce/src/pages/track-order.ts +196 -0
- package/templates/commerce/src/pages/wishlist.ts +83 -0
- package/templates/commerce/src/sections/about-story.ts +117 -0
- package/templates/commerce/src/sections/announcement-bar.ts +101 -0
- package/templates/commerce/src/sections/banner-grid.ts +319 -0
- package/templates/commerce/src/sections/campaign-banners.ts +158 -0
- package/templates/commerce/src/sections/category-slider.ts +144 -0
- package/templates/commerce/src/sections/content-builder.ts +123 -0
- package/templates/commerce/src/sections/content-controls.ts +45 -0
- package/templates/commerce/src/sections/custom-form.ts +59 -0
- package/templates/commerce/src/sections/faq-accordion.ts +123 -0
- package/templates/commerce/src/sections/footer.ts +728 -0
- package/templates/commerce/src/sections/header.ts +439 -0
- package/templates/commerce/src/sections/hero-slider.ts +492 -0
- package/templates/commerce/src/sections/hero.ts +137 -0
- package/templates/commerce/src/sections/index.ts +102 -0
- package/templates/commerce/src/sections/mobile-slider.ts +102 -0
- package/templates/commerce/src/sections/newsletter.ts +43 -0
- package/templates/commerce/src/sections/product-grid.ts +191 -0
- package/templates/commerce/src/sections/raw-html.ts +1 -0
- package/templates/commerce/src/sections/rich-text.ts +26 -0
- package/templates/commerce/src/sections/services-features.ts +211 -0
- package/templates/commerce/src/sections/testimonials.ts +194 -0
- package/templates/commerce/src/snippets/product-card.ts +178 -0
- package/templates/commerce/src/snippets/product-price.ts +46 -0
- package/templates/commerce/src/snippets/responsive-image.ts +29 -0
- package/templates/commerce/src/styles.ts +477 -0
- package/templates/commerce/src/templates/404.json +26 -0
- package/templates/commerce/src/templates/account.json +17 -0
- package/templates/commerce/src/templates/cart.json +17 -0
- package/templates/commerce/src/templates/category.json +16 -0
- package/templates/commerce/src/templates/checkout.json +15 -0
- package/templates/commerce/src/templates/collection.json +16 -0
- package/templates/commerce/src/templates/index.json +180 -0
- package/templates/commerce/src/templates/login.json +17 -0
- package/templates/commerce/src/templates/order-success.json +17 -0
- package/templates/commerce/src/templates/page.json +17 -0
- package/templates/commerce/src/templates/product.json +17 -0
- package/templates/commerce/src/templates/search.json +18 -0
- package/templates/commerce/src/templates/signup.json +17 -0
- package/templates/commerce/src/templates/track-order.json +17 -0
- package/templates/commerce/src/templates/wishlist.json +17 -0
- package/templates/commerce/src/templates.ts +510 -0
- package/templates/commerce/src/tokens.ts +22 -0
- package/templates/vscode-candy/README.md +22 -0
- package/templates/vscode-candy/extension.js +338 -0
- package/templates/vscode-candy/icons/candy-dark.svg +23 -0
- package/templates/vscode-candy/icons/candy-light.svg +23 -0
- package/templates/vscode-candy/icons/candy-logo.png +0 -0
- package/templates/vscode-candy/icons/candy-sweet-dark.svg +23 -0
- package/templates/vscode-candy/icons/candy-sweet-light.svg +23 -0
- package/templates/vscode-candy/language-configuration.json +47 -0
- package/templates/vscode-candy/package.json +103 -0
- package/templates/vscode-candy/schemas/candy-config.schema.json +56 -0
- package/templates/vscode-candy/schemas/candy-settings.schema.json +70 -0
- package/templates/vscode-candy/snippets/candy.code-snippets +179 -0
- package/templates/vscode-candy/syntaxes/candy.tmLanguage.json +296 -0
- package/templates/vscode-candy/vim/ftdetect/candy.vim +5 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customer Account Dashboard - Shared UI Components & Layout
|
|
3
|
+
*
|
|
4
|
+
* Production-ready components adhering to Joybee visual identity:
|
|
5
|
+
* - Fixed/sticky desktop sidebar (260px) + spacious content area (max 1200px)
|
|
6
|
+
* - Compact customer identity card with initials avatar & member badge
|
|
7
|
+
* - Accessible SVG icon set with consistent sizing & stroke width
|
|
8
|
+
* - Understated hover & clear active route states
|
|
9
|
+
* - Mobile scrollable pill navigation without horizontal page overflow
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { getThemePageProfile } from '../theme-layout';
|
|
13
|
+
|
|
14
|
+
export function escapeHtml(str: string): string {
|
|
15
|
+
if (!str) return '';
|
|
16
|
+
return String(str)
|
|
17
|
+
.replace(/&/g, '&')
|
|
18
|
+
.replace(/</g, '<')
|
|
19
|
+
.replace(/>/g, '>')
|
|
20
|
+
.replace(/"/g, '"')
|
|
21
|
+
.replace(/'/g, ''');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// SVG Icon System (Consistent 18-20px, stroke-based, SSR-safe)
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
export const IconOverview = `<svg class="w-5 h-5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/></svg>`;
|
|
29
|
+
|
|
30
|
+
export const IconOrders = `<svg class="w-5 h-5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"/><line x1="3" y1="6" x2="21" y2="6"/><path d="M16 10a4 4 0 0 1-8 0"/></svg>`;
|
|
31
|
+
|
|
32
|
+
export const IconProfile = `<svg class="w-5 h-5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>`;
|
|
33
|
+
|
|
34
|
+
export const IconAddresses = `<svg class="w-5 h-5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>`;
|
|
35
|
+
|
|
36
|
+
export const IconDownloads = `<svg class="w-5 h-5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>`;
|
|
37
|
+
|
|
38
|
+
export const IconLogout = `<svg class="w-5 h-5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>`;
|
|
39
|
+
|
|
40
|
+
export const IconChevronRight = `<svg class="w-4 h-4 shrink-0 opacity-40 group-hover:opacity-100 transition-opacity" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"/></svg>`;
|
|
41
|
+
|
|
42
|
+
export const IconPhone = `<svg class="w-4 h-4 shrink-0 text-slate-400" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z"/></svg>`;
|
|
43
|
+
|
|
44
|
+
export const IconTrash = `<svg class="w-3.5 h-3.5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>`;
|
|
45
|
+
|
|
46
|
+
export const IconShield = `<svg class="w-5 h-5 text-indigo-500" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>`;
|
|
47
|
+
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Navigation Definition
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
export interface AccountNavItem {
|
|
53
|
+
id: string;
|
|
54
|
+
label: string;
|
|
55
|
+
route: string;
|
|
56
|
+
icon: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const ACCOUNT_NAV_ITEMS: AccountNavItem[] = [
|
|
60
|
+
{ id: 'overview', label: 'Overview', route: '/account', icon: IconOverview },
|
|
61
|
+
{ id: 'orders', label: 'Orders', route: '/account/orders', icon: IconOrders },
|
|
62
|
+
{ id: 'profile', label: 'Profile', route: '/account/profile', icon: IconProfile },
|
|
63
|
+
{ id: 'addresses', label: 'Addresses', route: '/account/addresses', icon: IconAddresses },
|
|
64
|
+
{ id: 'downloads', label: 'Downloads', route: '/account/downloads', icon: IconDownloads },
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
export function resolveCustomerIdentity(customer: any | null | undefined): {
|
|
68
|
+
name: string;
|
|
69
|
+
email: string;
|
|
70
|
+
initial: string;
|
|
71
|
+
} {
|
|
72
|
+
const c = customer || {};
|
|
73
|
+
let name = c.name;
|
|
74
|
+
if (!name && (c.firstName || c.lastName)) {
|
|
75
|
+
name = `${c.firstName || ''} ${c.lastName || ''}`.trim();
|
|
76
|
+
}
|
|
77
|
+
if (!name && c.username) {
|
|
78
|
+
name = c.username;
|
|
79
|
+
}
|
|
80
|
+
if (!name) {
|
|
81
|
+
name = 'Valued Customer';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const email = c.email || 'customer@example.com';
|
|
85
|
+
const initial = (name.charAt(0) || 'C').toUpperCase();
|
|
86
|
+
|
|
87
|
+
return { name, email, initial };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
// AccountSidebar Component (Desktop >=1024px)
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
|
|
94
|
+
export function renderAccountSidebar(params: {
|
|
95
|
+
customer: any;
|
|
96
|
+
activeTab: string;
|
|
97
|
+
}): string {
|
|
98
|
+
const { name, email, initial } = resolveCustomerIdentity(params.customer);
|
|
99
|
+
const activeTab = params.activeTab || 'overview';
|
|
100
|
+
|
|
101
|
+
return `
|
|
102
|
+
<aside class="hidden lg:block w-[260px] shrink-0 sticky top-24 self-start" aria-label="Account navigation">
|
|
103
|
+
<div class="bg-white dark:bg-slate-900 rounded-3xl border border-slate-200/80 dark:border-slate-800 shadow-sm p-6 overflow-hidden">
|
|
104
|
+
|
|
105
|
+
<!-- Customer Identity Section -->
|
|
106
|
+
<div class="flex items-center gap-3.5 pb-6 border-b border-slate-100 dark:border-slate-800 mb-6">
|
|
107
|
+
<div class="w-12 h-12 rounded-2xl bg-gradient-to-tr from-indigo-600 via-indigo-500 to-violet-500 text-white flex items-center justify-center font-black text-lg shadow-md shadow-indigo-500/20 shrink-0 select-none">
|
|
108
|
+
${escapeHtml(initial)}
|
|
109
|
+
</div>
|
|
110
|
+
<div class="min-w-0 flex-1">
|
|
111
|
+
<div class="flex items-center gap-1.5">
|
|
112
|
+
<span class="font-extrabold text-slate-900 dark:text-white truncate text-sm" title="${escapeHtml(name)}">
|
|
113
|
+
${escapeHtml(name)}
|
|
114
|
+
</span>
|
|
115
|
+
</div>
|
|
116
|
+
<span class="inline-block mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider bg-indigo-50 dark:bg-indigo-950/60 text-indigo-700 dark:text-indigo-300 border border-indigo-200 dark:border-indigo-800">
|
|
117
|
+
Member
|
|
118
|
+
</span>
|
|
119
|
+
<p class="text-xs text-slate-500 dark:text-slate-400 truncate mt-1" title="${escapeHtml(email)}">
|
|
120
|
+
${escapeHtml(email)}
|
|
121
|
+
</p>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<!-- Navigation Links -->
|
|
126
|
+
<nav class="space-y-1">
|
|
127
|
+
${ACCOUNT_NAV_ITEMS.map((item) => {
|
|
128
|
+
const isActive = activeTab === item.id;
|
|
129
|
+
const activeClasses = isActive
|
|
130
|
+
? 'bg-indigo-50 dark:bg-indigo-950/60 text-indigo-700 dark:text-indigo-300 font-semibold border-l-4 border-indigo-600 pl-3 pr-3.5 shadow-sm'
|
|
131
|
+
: 'text-slate-600 dark:text-slate-400 hover:text-slate-900 dark:hover:text-white hover:bg-slate-50 dark:hover:bg-slate-800/60 font-medium px-3.5 border-l-4 border-transparent';
|
|
132
|
+
|
|
133
|
+
return `
|
|
134
|
+
<a
|
|
135
|
+
href="${item.route}"
|
|
136
|
+
class="group flex items-center justify-between py-2.5 rounded-xl text-sm transition-all ${activeClasses}"
|
|
137
|
+
${isActive ? 'aria-current="page"' : ''}
|
|
138
|
+
>
|
|
139
|
+
<div class="flex items-center gap-3 min-w-0">
|
|
140
|
+
<span class="${isActive ? 'text-indigo-600 dark:text-indigo-400' : 'text-slate-400 dark:text-slate-500 group-hover:text-slate-600 dark:group-hover:text-slate-300'} transition-colors">
|
|
141
|
+
${item.icon}
|
|
142
|
+
</span>
|
|
143
|
+
<span class="truncate">${escapeHtml(item.label)}</span>
|
|
144
|
+
</div>
|
|
145
|
+
${IconChevronRight}
|
|
146
|
+
</a>
|
|
147
|
+
`;
|
|
148
|
+
}).join('')}
|
|
149
|
+
</nav>
|
|
150
|
+
|
|
151
|
+
<!-- Log Out Action Button -->
|
|
152
|
+
<div class="pt-6 mt-6 border-t border-slate-100 dark:border-slate-800">
|
|
153
|
+
<button
|
|
154
|
+
type="button"
|
|
155
|
+
class="w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm font-semibold text-rose-600 dark:text-rose-400 hover:bg-rose-50 dark:hover:bg-rose-950/30 transition-colors cursor-pointer js-auth-logout js-logout-btn"
|
|
156
|
+
>
|
|
157
|
+
${IconLogout}
|
|
158
|
+
<span>Log Out</span>
|
|
159
|
+
</button>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
</div>
|
|
163
|
+
</aside>
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
// AccountMobileNavigation Component (Mobile & Tablet <1024px)
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
|
|
171
|
+
export function renderAccountMobileNavigation(params: {
|
|
172
|
+
customer: any;
|
|
173
|
+
activeTab: string;
|
|
174
|
+
}): string {
|
|
175
|
+
const { name, email, initial } = resolveCustomerIdentity(params.customer);
|
|
176
|
+
const activeTab = params.activeTab || 'overview';
|
|
177
|
+
|
|
178
|
+
return `
|
|
179
|
+
<div class="lg:hidden mb-8 space-y-4">
|
|
180
|
+
<!-- Mobile Profile Identity Card -->
|
|
181
|
+
<div class="bg-white dark:bg-slate-900 rounded-2xl border border-slate-200/80 dark:border-slate-800 shadow-sm p-4 flex items-center justify-between gap-3">
|
|
182
|
+
<div class="flex items-center gap-3 min-w-0">
|
|
183
|
+
<div class="w-11 h-11 rounded-xl bg-gradient-to-tr from-indigo-600 via-indigo-500 to-violet-500 text-white flex items-center justify-center font-black text-base shadow-sm shrink-0 select-none">
|
|
184
|
+
${escapeHtml(initial)}
|
|
185
|
+
</div>
|
|
186
|
+
<div class="min-w-0">
|
|
187
|
+
<div class="flex items-center gap-2">
|
|
188
|
+
<span class="font-extrabold text-slate-900 dark:text-white truncate text-sm">
|
|
189
|
+
${escapeHtml(name)}
|
|
190
|
+
</span>
|
|
191
|
+
<span class="px-2 py-0.2 rounded-full text-[10px] font-bold uppercase tracking-wider bg-indigo-50 dark:bg-indigo-950/60 text-indigo-700 dark:text-indigo-300 border border-indigo-200 dark:border-indigo-800 shrink-0">
|
|
192
|
+
Member
|
|
193
|
+
</span>
|
|
194
|
+
</div>
|
|
195
|
+
<p class="text-xs text-slate-500 dark:text-slate-400 truncate mt-0.5">
|
|
196
|
+
${escapeHtml(email)}
|
|
197
|
+
</p>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
<button
|
|
201
|
+
type="button"
|
|
202
|
+
class="p-2.5 text-rose-600 hover:bg-rose-50 dark:hover:bg-rose-950/40 rounded-xl transition-colors cursor-pointer shrink-0 js-auth-logout js-logout-btn"
|
|
203
|
+
title="Log Out"
|
|
204
|
+
aria-label="Log Out"
|
|
205
|
+
>
|
|
206
|
+
${IconLogout}
|
|
207
|
+
</button>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<!-- Mobile Horizontal Scrollable Tabs -->
|
|
211
|
+
<nav class="flex items-center gap-2 overflow-x-auto pb-1 -mx-4 px-4 sm:mx-0 sm:px-0" aria-label="Customer account navigation">
|
|
212
|
+
${ACCOUNT_NAV_ITEMS.map((item) => {
|
|
213
|
+
const isActive = activeTab === item.id;
|
|
214
|
+
const activeClasses = isActive
|
|
215
|
+
? 'bg-indigo-600 text-white font-semibold shadow-sm shadow-indigo-500/20'
|
|
216
|
+
: 'bg-white dark:bg-slate-900 text-slate-600 dark:text-slate-300 border border-slate-200/80 dark:border-slate-800 hover:bg-slate-50 dark:hover:bg-slate-800 font-medium';
|
|
217
|
+
|
|
218
|
+
return `
|
|
219
|
+
<a
|
|
220
|
+
href="${item.route}"
|
|
221
|
+
class="inline-flex items-center gap-2 px-4 py-2 rounded-xl text-xs shrink-0 whitespace-nowrap transition-all ${activeClasses}"
|
|
222
|
+
${isActive ? 'aria-current="page"' : ''}
|
|
223
|
+
>
|
|
224
|
+
<span>${item.icon}</span>
|
|
225
|
+
<span>${escapeHtml(item.label)}</span>
|
|
226
|
+
</a>
|
|
227
|
+
`;
|
|
228
|
+
}).join('')}
|
|
229
|
+
</nav>
|
|
230
|
+
</div>
|
|
231
|
+
`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// ---------------------------------------------------------------------------
|
|
235
|
+
// AccountPageHeader Component
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
|
|
238
|
+
export function renderAccountPageHeader(params: {
|
|
239
|
+
title: string;
|
|
240
|
+
description: string;
|
|
241
|
+
badge?: string;
|
|
242
|
+
actionHtml?: string;
|
|
243
|
+
}): string {
|
|
244
|
+
return `
|
|
245
|
+
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between pb-6 border-b border-slate-200/80 dark:border-slate-800 mb-6 gap-4">
|
|
246
|
+
<div>
|
|
247
|
+
<div class="flex items-center gap-3">
|
|
248
|
+
<h1 class="text-2xl sm:text-3xl font-extrabold tracking-tight text-slate-900 dark:text-white font-heading">
|
|
249
|
+
${escapeHtml(params.title)}
|
|
250
|
+
</h1>
|
|
251
|
+
${params.badge ? `
|
|
252
|
+
<span class="px-2.5 py-0.5 rounded-full text-xs font-bold bg-slate-100 dark:bg-slate-800 text-slate-700 dark:text-slate-300">
|
|
253
|
+
${escapeHtml(params.badge)}
|
|
254
|
+
</span>
|
|
255
|
+
` : ''}
|
|
256
|
+
</div>
|
|
257
|
+
<p class="text-sm text-slate-500 dark:text-slate-400 mt-1">
|
|
258
|
+
${escapeHtml(params.description)}
|
|
259
|
+
</p>
|
|
260
|
+
</div>
|
|
261
|
+
${params.actionHtml ? `
|
|
262
|
+
<div class="flex items-center gap-2.5 shrink-0">
|
|
263
|
+
${params.actionHtml}
|
|
264
|
+
</div>
|
|
265
|
+
` : ''}
|
|
266
|
+
</div>
|
|
267
|
+
`;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// ---------------------------------------------------------------------------
|
|
271
|
+
// AccountCard Container Component
|
|
272
|
+
// ---------------------------------------------------------------------------
|
|
273
|
+
|
|
274
|
+
export function renderAccountCard(params: {
|
|
275
|
+
title?: string;
|
|
276
|
+
description?: string;
|
|
277
|
+
body: string;
|
|
278
|
+
classNames?: string;
|
|
279
|
+
}): string {
|
|
280
|
+
return `
|
|
281
|
+
<div class="bg-white dark:bg-slate-900 rounded-3xl border border-slate-200/80 dark:border-slate-800 shadow-sm p-6 sm:p-8 ${params.classNames || ''}">
|
|
282
|
+
${params.title ? `
|
|
283
|
+
<div class="pb-5 border-b border-slate-100 dark:border-slate-800 mb-6">
|
|
284
|
+
<h2 class="text-lg font-bold tracking-tight text-slate-900 dark:text-white font-heading">
|
|
285
|
+
${escapeHtml(params.title)}
|
|
286
|
+
</h2>
|
|
287
|
+
${params.description ? `
|
|
288
|
+
<p class="text-xs text-slate-500 dark:text-slate-400 mt-0.5">
|
|
289
|
+
${escapeHtml(params.description)}
|
|
290
|
+
</p>
|
|
291
|
+
` : ''}
|
|
292
|
+
</div>
|
|
293
|
+
` : ''}
|
|
294
|
+
${params.body}
|
|
295
|
+
</div>
|
|
296
|
+
`;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// ---------------------------------------------------------------------------
|
|
300
|
+
// AccountEmptyState Component
|
|
301
|
+
// ---------------------------------------------------------------------------
|
|
302
|
+
|
|
303
|
+
export function renderAccountEmptyState(params: {
|
|
304
|
+
icon?: string;
|
|
305
|
+
title: string;
|
|
306
|
+
description: string;
|
|
307
|
+
actionUrl?: string;
|
|
308
|
+
actionLabel?: string;
|
|
309
|
+
}): string {
|
|
310
|
+
const icon = params.icon || `<svg class="w-12 h-12 text-slate-300 dark:text-slate-700 mx-auto" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" /></svg>`;
|
|
311
|
+
|
|
312
|
+
return `
|
|
313
|
+
<div class="text-center py-12 px-4">
|
|
314
|
+
<div class="mb-3">${icon}</div>
|
|
315
|
+
<h3 class="text-base font-bold text-slate-900 dark:text-white font-heading">
|
|
316
|
+
${escapeHtml(params.title)}
|
|
317
|
+
</h3>
|
|
318
|
+
<p class="text-sm text-slate-500 dark:text-slate-400 mt-1 max-w-sm mx-auto">
|
|
319
|
+
${escapeHtml(params.description)}
|
|
320
|
+
</p>
|
|
321
|
+
${params.actionUrl && params.actionLabel ? `
|
|
322
|
+
<a
|
|
323
|
+
href="${escapeHtml(params.actionUrl)}"
|
|
324
|
+
class="sf-btn sf-btn--primary mt-5 inline-flex items-center justify-center px-6 py-2.5 rounded-xl bg-[var(--sf-color-primary)] hover:bg-[var(--sf-color-secondary)] text-[var(--sf-color-primary-text)] hover:text-white font-semibold text-xs shadow-md active:scale-95 transition-all"
|
|
325
|
+
>
|
|
326
|
+
${escapeHtml(params.actionLabel)}
|
|
327
|
+
</a>
|
|
328
|
+
` : ''}
|
|
329
|
+
</div>
|
|
330
|
+
`;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// ---------------------------------------------------------------------------
|
|
334
|
+
// AccountLayout Container Component
|
|
335
|
+
// ---------------------------------------------------------------------------
|
|
336
|
+
|
|
337
|
+
export function renderAccountLayout(params: {
|
|
338
|
+
customer: any;
|
|
339
|
+
activeTab: string;
|
|
340
|
+
content: string;
|
|
341
|
+
themeSlug?: string | undefined;
|
|
342
|
+
}): string {
|
|
343
|
+
const profile = getThemePageProfile(params.themeSlug);
|
|
344
|
+
return `
|
|
345
|
+
<section class="sf-account-dashboard sf-boilerplate-account min-h-[calc(100vh-80px)] py-8 sm:py-12 bg-[var(--sf-color-bg)] font-sans">
|
|
346
|
+
<div class="max-w-[1200px] mx-auto px-4 sm:px-6 lg:px-8">
|
|
347
|
+
|
|
348
|
+
${profile.checkoutBannerHtml}
|
|
349
|
+
|
|
350
|
+
<!-- Mobile/Tablet Navigation (<1024px) -->
|
|
351
|
+
${renderAccountMobileNavigation({ customer: params.customer, activeTab: params.activeTab })}
|
|
352
|
+
|
|
353
|
+
<!-- Desktop 2-Column Dashboard Grid (>=1024px) -->
|
|
354
|
+
<div class="flex flex-col lg:flex-row items-start gap-7 lg:gap-8">
|
|
355
|
+
|
|
356
|
+
<!-- Sticky Sidebar -->
|
|
357
|
+
${renderAccountSidebar({ customer: params.customer, activeTab: params.activeTab })}
|
|
358
|
+
|
|
359
|
+
<!-- Main Content Surface -->
|
|
360
|
+
<main class="w-full flex-1 min-w-0 space-y-6">
|
|
361
|
+
${params.content}
|
|
362
|
+
</main>
|
|
363
|
+
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
</section>
|
|
367
|
+
`;
|
|
368
|
+
}
|
|
369
|
+
|