@actuate-media/plugin-commerce 0.0.11 → 0.0.12
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/CHANGELOG.md +111 -0
- package/README.md +28 -0
- package/dist/__tests__/index.test.js.map +1 -1
- package/dist/admin/CommerceDashboard.d.ts +1 -1
- package/dist/admin/CommerceDashboard.d.ts.map +1 -1
- package/dist/admin/CommerceDashboard.js +25 -9
- package/dist/admin/CommerceDashboard.js.map +1 -1
- package/dist/admin/DiscountManager.d.ts +4 -4
- package/dist/admin/DiscountManager.d.ts.map +1 -1
- package/dist/admin/DiscountManager.js +43 -19
- package/dist/admin/DiscountManager.js.map +1 -1
- package/dist/admin/OrderDetail.d.ts +4 -4
- package/dist/admin/OrderDetail.d.ts.map +1 -1
- package/dist/admin/OrderDetail.js +45 -9
- package/dist/admin/OrderDetail.js.map +1 -1
- package/dist/admin/OrderList.d.ts +2 -2
- package/dist/admin/OrderList.d.ts.map +1 -1
- package/dist/admin/OrderList.js +14 -14
- package/dist/admin/OrderList.js.map +1 -1
- package/dist/admin/ProductEdit.d.ts +3 -3
- package/dist/admin/ProductEdit.d.ts.map +1 -1
- package/dist/admin/ProductEdit.js +23 -13
- package/dist/admin/ProductEdit.js.map +1 -1
- package/dist/admin/ProductList.d.ts +3 -3
- package/dist/admin/ProductList.d.ts.map +1 -1
- package/dist/admin/ProductList.js +20 -10
- package/dist/admin/ProductList.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +11 -10
- package/dist/client.js.map +1 -1
- package/dist/collections.d.ts +1 -1
- package/dist/collections.d.ts.map +1 -1
- package/dist/collections.js +199 -205
- package/dist/collections.js.map +1 -1
- package/dist/fields.d.ts +1 -1
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js.map +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +8 -8
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/stripe/checkout.d.ts.map +1 -1
- package/dist/stripe/checkout.js +7 -9
- package/dist/stripe/checkout.js.map +1 -1
- package/dist/stripe/customer.d.ts.map +1 -1
- package/dist/stripe/customer.js.map +1 -1
- package/dist/stripe/products.d.ts.map +1 -1
- package/dist/stripe/products.js.map +1 -1
- package/dist/stripe/webhooks.d.ts.map +1 -1
- package/dist/stripe/webhooks.js +13 -13
- package/dist/stripe/webhooks.js.map +1 -1
- package/package.json +5 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# @actuate-media/plugin-commerce
|
|
2
|
+
|
|
3
|
+
## 0.0.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 854152d: Developer experience improvements from external-consumer feedback:
|
|
8
|
+
- Every published package now ships its `CHANGELOG.md` in the npm tarball, and packages that were missing a `README.md` (cli, cms-admin, cms-core, import, platform-vercel, all plugins, sections-react) now have one — so release notes and usage docs are visible on npmjs.com and in `node_modules`.
|
|
9
|
+
- New client-safe form validation entry point: `@actuate-media/cms-core/forms/client` exports `validateFormFieldClient()`, `validateFormValuesClient()`, visibility/conditional helpers, and the exact `FORM_EMAIL_RE` / `FORM_PHONE_RE` regexes the server enforces — zero Node dependencies, so public-site forms can mirror server rules without reimplementing them. The server validator now imports the same primitives, so client and server can never drift.
|
|
10
|
+
|
|
11
|
+
## 0.0.11
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- b5de8dd: Fix ESM module resolution and dependency duplication issues reported during consumer integration.
|
|
16
|
+
- Add "default" export condition to all platform and plugin packages so they resolve correctly from require() contexts (fixes ERR_PACKAGE_PATH_NOT_EXPORTED in next.config.ts and serverless functions).
|
|
17
|
+
- Move @actuate-media/cms-core from direct dependencies to peerDependencies across all packages to prevent duplicate installations when consumer version ranges don't exactly match the pinned version.
|
|
18
|
+
- Add "prepack" lifecycle script to create-actuate-cms to guarantee dist/ is built before npm publishes the package (fixes empty dist/ in v0.4.0).
|
|
19
|
+
|
|
20
|
+
## 0.0.10
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [54c7a3b]
|
|
25
|
+
- @actuate-media/cms-core@0.6.0
|
|
26
|
+
|
|
27
|
+
## 0.0.9
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [c08cf8b]
|
|
32
|
+
- Updated dependencies [80aa939]
|
|
33
|
+
- @actuate-media/cms-core@0.5.0
|
|
34
|
+
|
|
35
|
+
## 0.0.8
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [f2cf7d7]
|
|
40
|
+
- @actuate-media/cms-core@0.4.0
|
|
41
|
+
|
|
42
|
+
## 0.0.7
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [0621037]
|
|
47
|
+
- @actuate-media/cms-core@0.3.1
|
|
48
|
+
|
|
49
|
+
## 0.0.6
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Updated dependencies [4e3a5eb]
|
|
54
|
+
- @actuate-media/cms-core@0.3.0
|
|
55
|
+
|
|
56
|
+
## 0.0.5
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Updated dependencies
|
|
61
|
+
- @actuate-media/cms-core@0.2.3
|
|
62
|
+
|
|
63
|
+
## 0.0.4
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Updated dependencies
|
|
68
|
+
- @actuate-media/cms-core@0.2.2
|
|
69
|
+
|
|
70
|
+
## 0.0.3
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- Updated dependencies
|
|
75
|
+
- @actuate-media/cms-core@0.2.1
|
|
76
|
+
|
|
77
|
+
## 0.0.2
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- 3fd38a2: Fix all 13 integration issues discovered during MaidPro.co deployment
|
|
82
|
+
|
|
83
|
+
**cms-core:**
|
|
84
|
+
- Add .js extensions to all ESM relative imports (58 files)
|
|
85
|
+
- Replace workspace:\* with versioned deps in all packages
|
|
86
|
+
- Add sideEffects:false for proper tree-shaking
|
|
87
|
+
- Subpath exports (/config, /api, /middleware, /next) avoid barrel side effects
|
|
88
|
+
- Stats/search routes use safeCount/safeFindMany for missing Prisma models
|
|
89
|
+
- Ship prisma/cms-schema.prisma with all required CMS models
|
|
90
|
+
- Accept both CMS_SECRET and CMS_SESSION_SECRET with clear error messages
|
|
91
|
+
- Fix hardcoded /admin paths in OAuth flow (now uses getAdminPath())
|
|
92
|
+
- Loosen withActuateCMS and createCMSMiddleware parameter types
|
|
93
|
+
- Auto-inject transpilePackages and serverExternalPackages in withActuateCMS
|
|
94
|
+
- Unify PluginDefinition with ActuatePlugin interface
|
|
95
|
+
|
|
96
|
+
**cms-admin:**
|
|
97
|
+
- Scope all 40+ CSS theme variables to .actuate-admin instead of :root
|
|
98
|
+
- ThemeProvider applies dark class to .actuate-admin, not document.documentElement
|
|
99
|
+
- Scaffold uses (admin)/(site) route groups for full CSS/script isolation
|
|
100
|
+
- Sidebar branding supports custom logo via config.admin.branding
|
|
101
|
+
|
|
102
|
+
**platform-vercel:**
|
|
103
|
+
- Email adapter accepts both `from` and `defaultFrom`
|
|
104
|
+
|
|
105
|
+
**All plugin/platform packages:**
|
|
106
|
+
- Fix ESM .js extensions in compiled output
|
|
107
|
+
- Replace workspace:\* with ^0.1.0 for publishable deps
|
|
108
|
+
|
|
109
|
+
- Updated dependencies [682dac7]
|
|
110
|
+
- Updated dependencies [3fd38a2]
|
|
111
|
+
- @actuate-media/cms-core@0.2.0
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @actuate-media/plugin-commerce
|
|
2
|
+
|
|
3
|
+
Commerce collections for [Actuate CMS](https://github.com/actuate-media/actuatecms)
|
|
4
|
+
— products, categories, and pricing fields.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @actuate-media/plugin-commerce
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { commercePlugin } from '@actuate-media/plugin-commerce'
|
|
14
|
+
|
|
15
|
+
export default defineConfig({
|
|
16
|
+
plugins: [commercePlugin()],
|
|
17
|
+
// ...
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Release notes
|
|
22
|
+
|
|
23
|
+
See [CHANGELOG.md](./CHANGELOG.md) (shipped with the package) or the
|
|
24
|
+
[GitHub releases](https://github.com/actuate-media/actuatecms/releases).
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,CAAC,cAAc,EAAE,CAAC,IAAI,CAA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AC,CAAC,CAAC,CAAA;YAC/C,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QACzD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,MAAM,GAAG,cAAc,CAAC,EAAE,CAAC,CAAA;YACjC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACtC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommerceDashboard.d.ts","sourceRoot":"","sources":["../../src/admin/CommerceDashboard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"CommerceDashboard.d.ts","sourceRoot":"","sources":["../../src/admin/CommerceDashboard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACtD;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,WAAW,CAAA;IACpB,MAAM,EAAE,UAAU,CAAA;IAClB,WAAW,EAAE,UAAU,EAAE,CAAA;CAC1B;AAwBD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,EACN,WAAW,GACZ,EAAE,sBAAsB,GAAG,KAAK,CAAC,YAAY,CA8H7C"}
|
|
@@ -1,20 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
function formatCurrency(amount, currency) {
|
|
4
|
-
return new Intl.NumberFormat(
|
|
4
|
+
return new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(amount);
|
|
5
5
|
}
|
|
6
|
-
function StatCard({ label, value, subtext }) {
|
|
7
|
-
return (_jsxs("div", { style: { background:
|
|
6
|
+
function StatCard({ label, value, subtext, }) {
|
|
7
|
+
return (_jsxs("div", { style: { background: '#fff', border: '1px solid #e5e7eb', borderRadius: 8, padding: 16 }, children: [_jsx("div", { style: { fontSize: 13, color: '#6b7280', marginBottom: 4 }, children: label }), _jsx("div", { style: { fontSize: 24, fontWeight: 700 }, children: value }), subtext && _jsx("div", { style: { fontSize: 12, color: '#9ca3af', marginTop: 4 }, children: subtext })] }));
|
|
8
8
|
}
|
|
9
9
|
/** Commerce overview dashboard with revenue metrics, order stats, and top products. */
|
|
10
10
|
export function CommerceDashboard({ revenue, orders, topProducts, }) {
|
|
11
11
|
const maxDailyRevenue = Math.max(...revenue.dailyRevenue.map((d) => d.amount), 1);
|
|
12
|
-
return (_jsxs("div", { children: [_jsx("h2", { style: { marginBottom: 24 }, children: "Commerce Dashboard" }), _jsxs("div", { style: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
return (_jsxs("div", { children: [_jsx("h2", { style: { marginBottom: 24 }, children: "Commerce Dashboard" }), _jsxs("div", { style: {
|
|
13
|
+
display: 'grid',
|
|
14
|
+
gridTemplateColumns: 'repeat(4, 1fr)',
|
|
15
|
+
gap: 16,
|
|
16
|
+
marginBottom: 32,
|
|
17
|
+
}, children: [_jsx(StatCard, { label: "Total Revenue", value: formatCurrency(revenue.totalRevenue, revenue.currency) }), _jsx(StatCard, { label: "Today", value: formatCurrency(revenue.revenueToday, revenue.currency) }), _jsx(StatCard, { label: "This Week", value: formatCurrency(revenue.revenueThisWeek, revenue.currency) }), _jsx(StatCard, { label: "This Month", value: formatCurrency(revenue.revenueThisMonth, revenue.currency) })] }), _jsxs("div", { style: { border: '1px solid #e5e7eb', borderRadius: 8, padding: 16, marginBottom: 32 }, children: [_jsx("h3", { style: { marginTop: 0 }, children: "Daily Revenue" }), _jsx("div", { style: { display: 'flex', alignItems: 'flex-end', gap: 4, height: 120 }, children: revenue.dailyRevenue.map((day) => (_jsxs("div", { style: { flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center' }, children: [_jsx("div", { style: {
|
|
18
|
+
width: '100%',
|
|
19
|
+
background: '#3b82f6',
|
|
20
|
+
borderRadius: '4px 4px 0 0',
|
|
16
21
|
height: `${(day.amount / maxDailyRevenue) * 100}px`,
|
|
17
22
|
minHeight: 2,
|
|
18
|
-
}, title: `${day.date}: ${formatCurrency(day.amount, revenue.currency)}` }), _jsx("div", { style: {
|
|
23
|
+
}, title: `${day.date}: ${formatCurrency(day.amount, revenue.currency)}` }), _jsx("div", { style: {
|
|
24
|
+
fontSize: 9,
|
|
25
|
+
color: '#9ca3af',
|
|
26
|
+
marginTop: 4,
|
|
27
|
+
transform: 'rotate(-45deg)',
|
|
28
|
+
whiteSpace: 'nowrap',
|
|
29
|
+
}, children: day.date.slice(5) })] }, day.date))) })] }), _jsxs("div", { style: {
|
|
30
|
+
display: 'grid',
|
|
31
|
+
gridTemplateColumns: 'repeat(3, 1fr)',
|
|
32
|
+
gap: 16,
|
|
33
|
+
marginBottom: 32,
|
|
34
|
+
}, children: [_jsx(StatCard, { label: "Total Orders", value: String(orders.totalOrders) }), _jsx(StatCard, { label: "Avg Order Value", value: formatCurrency(orders.averageOrderValue, revenue.currency) }), _jsx(StatCard, { label: "Conversion Rate", value: `${(orders.conversionRate * 100).toFixed(1)}%` }), _jsx(StatCard, { label: "Pending", value: String(orders.pendingOrders) }), _jsx(StatCard, { label: "Processing", value: String(orders.processingOrders) }), _jsx(StatCard, { label: "Shipped", value: String(orders.shippedOrders) })] }), _jsxs("div", { style: { border: '1px solid #e5e7eb', borderRadius: 8, padding: 16 }, children: [_jsx("h3", { style: { marginTop: 0 }, children: "Top Products" }), _jsxs("table", { style: { width: '100%', borderCollapse: 'collapse' }, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: { textAlign: 'left', padding: 8 }, children: "Product" }), _jsx("th", { style: { textAlign: 'right', padding: 8 }, children: "Units Sold" }), _jsx("th", { style: { textAlign: 'right', padding: 8 }, children: "Revenue" })] }) }), _jsx("tbody", { children: topProducts.map((product, index) => (_jsxs("tr", { style: { borderTop: '1px solid #f3f4f6' }, children: [_jsx("td", { style: { padding: 8 }, children: _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8 }, children: [_jsxs("span", { style: { fontWeight: 600, color: '#6b7280', width: 20 }, children: [index + 1, "."] }), product.image && (_jsx("img", { src: product.image, alt: product.name, style: { width: 32, height: 32, borderRadius: 4, objectFit: 'cover' } })), _jsx("span", { style: { fontWeight: 500 }, children: product.name })] }) }), _jsx("td", { style: { textAlign: 'right', padding: 8 }, children: product.unitsSold }), _jsx("td", { style: { textAlign: 'right', padding: 8, fontWeight: 500 }, children: formatCurrency(product.revenue, revenue.currency) })] }, product.id))) })] })] })] }));
|
|
19
35
|
}
|
|
20
36
|
//# sourceMappingURL=CommerceDashboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommerceDashboard.js","sourceRoot":"","sources":["../../src/admin/CommerceDashboard.tsx"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"CommerceDashboard.js","sourceRoot":"","sources":["../../src/admin/CommerceDashboard.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAoCZ,SAAS,cAAc,CAAC,MAAc,EAAE,QAAgB;IACtD,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AACvF,CAAC;AAED,SAAS,QAAQ,CAAC,EAChB,KAAK,EACL,KAAK,EACL,OAAO,GAKR;IACC,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,aAC3F,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,EAAE,YAAG,KAAK,GAAO,EAC9E,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,YAAG,KAAK,GAAO,EAC3D,OAAO,IAAI,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE,YAAG,OAAO,GAAO,IACrF,CACP,CAAA;AACH,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,EACN,WAAW,GACY;IACvB,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,GA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AAK,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,aAC1D,KAAK,GAAG,CAAC,SACL,EACN,OAAO,CAAC,KAAK,IAAI,CAChB,cACE,GAAG,EAAE,OAAO,CAAC,KAAK,EAClB,GAAG,EAAE,OAAO,CAAC,IAAI,EACjB,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GACrE,CACH,EACD,eAAM,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,YAAG,OAAO,CAAC,IAAI,GAAQ,IACnD,GACH,EACL,aAAI,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,YAAG,OAAO,CAAC,SAAS,GAAM,EACvE,aAAI,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,YAC3D,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAC/C,KAnBE,OAAO,CAAC,EAAE,CAoBd,CACN,CAAC,GACI,IACF,IACJ,IACF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface DiscountData {
|
|
3
3
|
id: string;
|
|
4
4
|
code: string;
|
|
5
|
-
type:
|
|
5
|
+
type: 'percentage' | 'fixed_amount' | 'free_shipping';
|
|
6
6
|
value: number;
|
|
7
7
|
minPurchase?: number;
|
|
8
8
|
maxUses?: number;
|
|
@@ -10,11 +10,11 @@ export interface DiscountData {
|
|
|
10
10
|
startsAt?: string;
|
|
11
11
|
expiresAt?: string;
|
|
12
12
|
isActive: boolean;
|
|
13
|
-
applicableTo:
|
|
13
|
+
applicableTo: 'all' | 'specific_products' | 'specific_categories';
|
|
14
14
|
}
|
|
15
15
|
export interface DiscountManagerProps {
|
|
16
16
|
discounts: DiscountData[];
|
|
17
|
-
onCreate: (data: Omit<DiscountData,
|
|
17
|
+
onCreate: (data: Omit<DiscountData, 'id' | 'usedCount'>) => void;
|
|
18
18
|
onEdit: (id: string, data: Partial<DiscountData>) => void;
|
|
19
19
|
onDelete: (id: string) => void;
|
|
20
20
|
onToggle: (id: string, active: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscountManager.d.ts","sourceRoot":"","sources":["../../src/admin/DiscountManager.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"DiscountManager.d.ts","sourceRoot":"","sources":["../../src/admin/DiscountManager.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,YAAY,GAAG,cAAc,GAAG,eAAe,CAAA;IACrD,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,KAAK,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;CAClE;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,YAAY,EAAE,CAAA;IACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,WAAW,CAAC,KAAK,IAAI,CAAA;IAChE,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAA;IACzD,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;CAChD;AAaD,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,QAAQ,EACR,MAAM,EAAE,OAAO,EACf,QAAQ,EACR,QAAQ,GACT,EAAE,oBAAoB,GAAG,KAAK,CAAC,YAAY,CAqM3C"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from
|
|
3
|
+
import { useState } from 'react';
|
|
4
4
|
function formatValue(type, value) {
|
|
5
5
|
switch (type) {
|
|
6
|
-
case
|
|
6
|
+
case 'percentage':
|
|
7
7
|
return `${value}%`;
|
|
8
|
-
case
|
|
9
|
-
return new Intl.NumberFormat(
|
|
10
|
-
case
|
|
11
|
-
return
|
|
8
|
+
case 'fixed_amount':
|
|
9
|
+
return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(value);
|
|
10
|
+
case 'free_shipping':
|
|
11
|
+
return 'Free shipping';
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
/** Manages discount codes with creation, editing, toggling, and deletion. */
|
|
15
15
|
export function DiscountManager({ discounts, onCreate, onEdit: _onEdit, onDelete, onToggle, }) {
|
|
16
16
|
const [showCreate, setShowCreate] = useState(false);
|
|
17
|
-
const [newCode, setNewCode] = useState(
|
|
18
|
-
const [newType, setNewType] = useState(
|
|
17
|
+
const [newCode, setNewCode] = useState('');
|
|
18
|
+
const [newType, setNewType] = useState('percentage');
|
|
19
19
|
const [newValue, setNewValue] = useState(0);
|
|
20
20
|
const [newMinPurchase, setNewMinPurchase] = useState();
|
|
21
21
|
const [newMaxUses, setNewMaxUses] = useState();
|
|
@@ -27,27 +27,51 @@ export function DiscountManager({ discounts, onCreate, onEdit: _onEdit, onDelete
|
|
|
27
27
|
minPurchase: newMinPurchase,
|
|
28
28
|
maxUses: newMaxUses,
|
|
29
29
|
isActive: true,
|
|
30
|
-
applicableTo:
|
|
30
|
+
applicableTo: 'all',
|
|
31
31
|
});
|
|
32
32
|
setShowCreate(false);
|
|
33
|
-
setNewCode(
|
|
33
|
+
setNewCode('');
|
|
34
34
|
setNewValue(0);
|
|
35
35
|
};
|
|
36
36
|
const sectionStyle = {
|
|
37
|
-
border:
|
|
37
|
+
border: '1px solid #e5e7eb',
|
|
38
38
|
borderRadius: 8,
|
|
39
39
|
padding: 16,
|
|
40
40
|
marginBottom: 16,
|
|
41
41
|
};
|
|
42
|
-
return (_jsxs("div", { children: [_jsxs("div", { style: { display:
|
|
43
|
-
|
|
42
|
+
return (_jsxs("div", { children: [_jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', marginBottom: 16 }, children: [_jsxs("h2", { children: ["Discounts (", discounts.length, ")"] }), _jsx("button", { onClick: () => setShowCreate(!showCreate), style: {
|
|
43
|
+
background: '#2563eb',
|
|
44
|
+
color: '#fff',
|
|
45
|
+
padding: '8px 16px',
|
|
46
|
+
borderRadius: 6,
|
|
47
|
+
border: 'none',
|
|
48
|
+
cursor: 'pointer',
|
|
49
|
+
}, children: showCreate ? 'Cancel' : 'Create Discount' })] }), showCreate && (_jsxs("div", { style: sectionStyle, children: [_jsx("h3", { children: "New Discount" }), _jsxs("div", { style: {
|
|
50
|
+
display: 'grid',
|
|
51
|
+
gridTemplateColumns: '1fr 1fr 1fr',
|
|
52
|
+
gap: 12,
|
|
53
|
+
marginBottom: 12,
|
|
54
|
+
}, children: [_jsxs("div", { children: [_jsx("label", { style: { display: 'block', marginBottom: 4 }, children: "Code" }), _jsx("input", { value: newCode, onChange: (e) => setNewCode(e.target.value.toUpperCase()), placeholder: "e.g. SAVE20", style: { width: '100%' } })] }), _jsxs("div", { children: [_jsx("label", { style: { display: 'block', marginBottom: 4 }, children: "Type" }), _jsxs("select", { value: newType, onChange: (e) => setNewType(e.target.value), style: { width: '100%' }, children: [_jsx("option", { value: "percentage", children: "Percentage" }), _jsx("option", { value: "fixed_amount", children: "Fixed Amount" }), _jsx("option", { value: "free_shipping", children: "Free Shipping" })] })] }), _jsxs("div", { children: [_jsx("label", { style: { display: 'block', marginBottom: 4 }, children: "Value" }), _jsx("input", { type: "number", value: newValue, onChange: (e) => setNewValue(parseFloat(e.target.value) || 0), style: { width: '100%' } })] })] }), _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12, marginBottom: 12 }, children: [_jsxs("div", { children: [_jsx("label", { style: { display: 'block', marginBottom: 4 }, children: "Min. Purchase" }), _jsx("input", { type: "number", value: newMinPurchase ?? '', onChange: (e) => setNewMinPurchase(parseFloat(e.target.value) || undefined), style: { width: '100%' } })] }), _jsxs("div", { children: [_jsx("label", { style: { display: 'block', marginBottom: 4 }, children: "Max Uses" }), _jsx("input", { type: "number", value: newMaxUses ?? '', onChange: (e) => setNewMaxUses(parseInt(e.target.value) || undefined), style: { width: '100%' } })] })] }), _jsx("button", { onClick: handleCreate, disabled: !newCode, style: {
|
|
55
|
+
background: '#059669',
|
|
56
|
+
color: '#fff',
|
|
57
|
+
padding: '6px 14px',
|
|
58
|
+
borderRadius: 6,
|
|
59
|
+
border: 'none',
|
|
60
|
+
cursor: 'pointer',
|
|
61
|
+
}, children: "Create" })] })), _jsxs("table", { style: { width: '100%', borderCollapse: 'collapse' }, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: { textAlign: 'left', padding: 8 }, children: "Code" }), _jsx("th", { style: { textAlign: 'left', padding: 8 }, children: "Type" }), _jsx("th", { style: { textAlign: 'right', padding: 8 }, children: "Value" }), _jsx("th", { style: { textAlign: 'right', padding: 8 }, children: "Usage" }), _jsx("th", { style: { textAlign: 'center', padding: 8 }, children: "Status" }), _jsx("th", { style: { textAlign: 'right', padding: 8 }, children: "Expires" }), _jsx("th", { style: { textAlign: 'right', padding: 8 }, children: "Actions" })] }) }), _jsx("tbody", { children: discounts.map((discount) => (_jsxs("tr", { style: { borderTop: '1px solid #e5e7eb' }, children: [_jsx("td", { style: { padding: 8, fontWeight: 600, fontFamily: 'monospace' }, children: discount.code }), _jsx("td", { style: { padding: 8, textTransform: 'capitalize' }, children: discount.type.replace('_', ' ') }), _jsx("td", { style: { textAlign: 'right', padding: 8 }, children: formatValue(discount.type, discount.value) }), _jsxs("td", { style: { textAlign: 'right', padding: 8 }, children: [discount.usedCount, discount.maxUses ? ` / ${discount.maxUses}` : ''] }), _jsx("td", { style: { textAlign: 'center', padding: 8 }, children: _jsx("button", { onClick: () => onToggle(discount.id, !discount.isActive), style: {
|
|
62
|
+
padding: '2px 10px',
|
|
44
63
|
borderRadius: 9999,
|
|
45
64
|
fontSize: 12,
|
|
46
65
|
fontWeight: 500,
|
|
47
|
-
border:
|
|
48
|
-
cursor:
|
|
49
|
-
background: discount.isActive ?
|
|
50
|
-
color: discount.isActive ?
|
|
51
|
-
}, children: discount.isActive ?
|
|
66
|
+
border: 'none',
|
|
67
|
+
cursor: 'pointer',
|
|
68
|
+
background: discount.isActive ? '#d1fae5' : '#fee2e2',
|
|
69
|
+
color: discount.isActive ? '#065f46' : '#991b1b',
|
|
70
|
+
}, children: discount.isActive ? 'Active' : 'Inactive' }) }), _jsx("td", { style: { textAlign: 'right', padding: 8, fontSize: 13, color: '#6b7280' }, children: discount.expiresAt ? new Date(discount.expiresAt).toLocaleDateString() : '—' }), _jsx("td", { style: { textAlign: 'right', padding: 8 }, children: _jsx("button", { onClick: () => onDelete(discount.id), style: {
|
|
71
|
+
color: '#dc2626',
|
|
72
|
+
cursor: 'pointer',
|
|
73
|
+
background: 'none',
|
|
74
|
+
border: 'none',
|
|
75
|
+
}, children: "Delete" }) })] }, discount.id))) })] })] }));
|
|
52
76
|
}
|
|
53
77
|
//# sourceMappingURL=DiscountManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscountManager.js","sourceRoot":"","sources":["../../src/admin/DiscountManager.tsx"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"DiscountManager.js","sourceRoot":"","sources":["../../src/admin/DiscountManager.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAwBvC,SAAS,WAAW,CAAC,IAA0B,EAAE,KAAa;IAC5D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,YAAY;YACf,OAAO,GAAG,KAAK,GAAG,CAAA;QACpB,KAAK,cAAc;YACjB,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC7F,KAAK,eAAe;YAClB,OAAO,eAAe,CAAA;IAC1B,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,eAAe,CAAC,EAC9B,SAAS,EACT,QAAQ,EACR,MAAM,EAAE,OAAO,EACf,QAAQ,EACR,QAAQ,GACa;IACrB,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACnD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC1C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAuB,YAAY,CAAC,CAAA;IAC1E,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC3C,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAsB,CAAA;IAC1E,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,EAAsB,CAAA;IAElE,MAAM,YAAY,GAAG,GAAG,EAA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| 'delivered' | 'cancelled' | 'refunded';
|
|
3
3
|
export interface Address {
|
|
4
4
|
line1: string;
|
|
5
5
|
line2?: string;
|
|
@@ -39,13 +39,13 @@ export interface PaymentData {
|
|
|
39
39
|
stripePaymentIntentId: string;
|
|
40
40
|
amount: number;
|
|
41
41
|
currency: string;
|
|
42
|
-
status:
|
|
42
|
+
status: 'pending' | 'succeeded' | 'failed' | 'refunded';
|
|
43
43
|
method: string;
|
|
44
44
|
paidAt?: string;
|
|
45
45
|
}
|
|
46
46
|
export interface TimelineEvent {
|
|
47
47
|
id: string;
|
|
48
|
-
type:
|
|
48
|
+
type: 'status_change' | 'payment' | 'note' | 'email';
|
|
49
49
|
description: string;
|
|
50
50
|
timestamp: string;
|
|
51
51
|
actor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderDetail.d.ts","sourceRoot":"","sources":["../../src/admin/OrderDetail.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"OrderDetail.d.ts","sourceRoot":"","sources":["../../src/admin/OrderDetail.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,WAAW,GACZ,SAAS,GACT,WAAW,GACX,YAAY,GACZ,SAAS,GACT,WAAW,GACX,WAAW,GACX,UAAU,CAAA;AAEd,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,WAAW,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA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;CAC1B;AAsBD,yFAAyF;AACzF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CAoNvC"}
|
|
@@ -1,26 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
function formatCurrency(amount, currency) {
|
|
4
|
-
return new Intl.NumberFormat(
|
|
4
|
+
return new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(amount);
|
|
5
5
|
}
|
|
6
6
|
function AddressBlock({ address, title }) {
|
|
7
|
-
return (_jsxs("div", { children: [_jsx("h4", { style: { margin:
|
|
7
|
+
return (_jsxs("div", { children: [_jsx("h4", { style: { margin: '0 0 4px' }, children: title }), _jsxs("div", { style: { fontSize: 14, color: '#374151' }, children: [_jsx("div", { children: address.line1 }), address.line2 && _jsx("div", { children: address.line2 }), _jsxs("div", { children: [address.city, ", ", address.state, " ", address.postalCode] }), _jsx("div", { children: address.country })] })] }));
|
|
8
8
|
}
|
|
9
9
|
/** Renders a full order detail view with timeline, items, payments, and address info. */
|
|
10
10
|
export function OrderDetail({ order, items, payments, timeline, }) {
|
|
11
11
|
const sectionStyle = {
|
|
12
|
-
border:
|
|
12
|
+
border: '1px solid #e5e7eb',
|
|
13
13
|
borderRadius: 8,
|
|
14
14
|
padding: 16,
|
|
15
15
|
marginBottom: 24,
|
|
16
16
|
};
|
|
17
|
-
return (_jsxs("div", { children: [_jsxs("div", { style: {
|
|
18
|
-
|
|
17
|
+
return (_jsxs("div", { children: [_jsxs("div", { style: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
marginBottom: 24,
|
|
22
|
+
}, children: [_jsxs("div", { children: [_jsxs("h2", { style: { margin: 0 }, children: ["Order ", order.orderNumber] }), _jsxs("span", { style: { color: '#6b7280', fontSize: 14 }, children: ["Placed ", new Date(order.placedAt).toLocaleString()] })] }), _jsx("span", { style: {
|
|
23
|
+
padding: '4px 12px',
|
|
19
24
|
borderRadius: 9999,
|
|
20
25
|
fontSize: 14,
|
|
21
26
|
fontWeight: 500,
|
|
22
|
-
background:
|
|
23
|
-
color:
|
|
24
|
-
}, children: order.status })] }), _jsxs("section", { style: sectionStyle, children: [_jsx("h3", { children: "Customer" }), _jsxs("div", { style: { marginBottom: 12 }, children: [_jsx("div", { style: { fontWeight: 500 }, children: order.customerName }), _jsx("div", { style: { fontSize: 14, color:
|
|
27
|
+
background: '#dbeafe',
|
|
28
|
+
color: '#1e40af',
|
|
29
|
+
}, children: order.status })] }), _jsxs("section", { style: sectionStyle, children: [_jsx("h3", { children: "Customer" }), _jsxs("div", { style: { marginBottom: 12 }, children: [_jsx("div", { style: { fontWeight: 500 }, children: order.customerName }), _jsx("div", { style: { fontSize: 14, color: '#6b7280' }, children: order.customerEmail })] }), _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 }, children: [_jsx(AddressBlock, { address: order.shippingAddress, title: "Shipping" }), _jsx(AddressBlock, { address: order.billingAddress, title: "Billing" })] })] }), _jsxs("section", { style: sectionStyle, children: [_jsx("h3", { children: "Items" }), _jsxs("table", { style: { width: '100%', borderCollapse: 'collapse' }, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: { textAlign: 'left', padding: 6 }, children: "Product" }), _jsx("th", { style: { textAlign: 'left', padding: 6 }, children: "SKU" }), _jsx("th", { style: { textAlign: 'right', padding: 6 }, children: "Qty" }), _jsx("th", { style: { textAlign: 'right', padding: 6 }, children: "Unit Price" }), _jsx("th", { style: { textAlign: 'right', padding: 6 }, children: "Total" })] }) }), _jsx("tbody", { children: items.map((item) => (_jsxs("tr", { style: { borderTop: '1px solid #f3f4f6' }, children: [_jsxs("td", { style: { padding: 6 }, children: [item.name, item.variantName && (_jsxs("span", { style: { color: '#6b7280', fontSize: 12 }, children: [" \u2014 ", item.variantName] }))] }), _jsx("td", { style: { padding: 6, color: '#6b7280', fontSize: 13 }, children: item.sku }), _jsx("td", { style: { textAlign: 'right', padding: 6 }, children: item.quantity }), _jsx("td", { style: { textAlign: 'right', padding: 6 }, children: formatCurrency(item.unitPrice, order.currency) }), _jsx("td", { style: { textAlign: 'right', padding: 6, fontWeight: 500 }, children: formatCurrency(item.totalPrice, order.currency) })] }, item.id))) })] }), _jsxs("div", { style: { marginTop: 12, borderTop: '1px solid #e5e7eb', paddingTop: 12 }, children: [_jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx("span", { children: "Subtotal" }), _jsx("span", { children: formatCurrency(order.subtotal, order.currency) })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx("span", { children: "Tax" }), _jsx("span", { children: formatCurrency(order.taxAmount, order.currency) })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx("span", { children: "Shipping" }), _jsx("span", { children: formatCurrency(order.shippingAmount, order.currency) })] }), order.discountAmount > 0 && (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', color: '#059669' }, children: [_jsx("span", { children: "Discount" }), _jsxs("span", { children: ["-", formatCurrency(order.discountAmount, order.currency)] })] })), _jsxs("div", { style: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
justifyContent: 'space-between',
|
|
32
|
+
fontWeight: 700,
|
|
33
|
+
fontSize: 16,
|
|
34
|
+
marginTop: 8,
|
|
35
|
+
paddingTop: 8,
|
|
36
|
+
borderTop: '2px solid #111827',
|
|
37
|
+
}, children: [_jsx("span", { children: "Total" }), _jsx("span", { children: formatCurrency(order.total, order.currency) })] })] })] }), _jsxs("section", { style: sectionStyle, children: [_jsx("h3", { children: "Payments" }), payments.length === 0 ? (_jsx("p", { style: { color: '#6b7280' }, children: "No payments recorded." })) : (payments.map((payment) => (_jsxs("div", { style: {
|
|
38
|
+
display: 'flex',
|
|
39
|
+
justifyContent: 'space-between',
|
|
40
|
+
padding: '8px 0',
|
|
41
|
+
borderBottom: '1px solid #f3f4f6',
|
|
42
|
+
}, children: [_jsxs("div", { children: [_jsx("div", { style: { fontWeight: 500 }, children: formatCurrency(payment.amount, payment.currency) }), _jsxs("div", { style: { fontSize: 12, color: '#6b7280' }, children: [payment.method, " \u2014 ", payment.stripePaymentIntentId] })] }), _jsxs("div", { style: { textAlign: 'right' }, children: [_jsx("span", { style: {
|
|
43
|
+
padding: '2px 8px',
|
|
44
|
+
borderRadius: 9999,
|
|
45
|
+
fontSize: 12,
|
|
46
|
+
background: payment.status === 'succeeded' ? '#d1fae5' : '#fef3c7',
|
|
47
|
+
color: payment.status === 'succeeded' ? '#065f46' : '#92400e',
|
|
48
|
+
}, children: payment.status }), payment.paidAt && (_jsx("div", { style: { fontSize: 12, color: '#6b7280', marginTop: 4 }, children: new Date(payment.paidAt).toLocaleString() }))] })] }, payment.id))))] }), _jsxs("section", { style: sectionStyle, children: [_jsx("h3", { children: "Timeline" }), timeline.map((event) => (_jsxs("div", { style: {
|
|
49
|
+
display: 'flex',
|
|
50
|
+
gap: 12,
|
|
51
|
+
padding: '8px 0',
|
|
52
|
+
borderBottom: '1px solid #f3f4f6',
|
|
53
|
+
}, children: [_jsx("div", { style: {
|
|
54
|
+
width: 8,
|
|
55
|
+
height: 8,
|
|
56
|
+
borderRadius: '50%',
|
|
57
|
+
background: '#6b7280',
|
|
58
|
+
marginTop: 6,
|
|
59
|
+
flexShrink: 0,
|
|
60
|
+
} }), _jsxs("div", { children: [_jsx("div", { style: { fontSize: 14 }, children: event.description }), _jsxs("div", { style: { fontSize: 12, color: '#9ca3af' }, children: [new Date(event.timestamp).toLocaleString(), event.actor && ` — ${event.actor}`] })] })] }, event.id)))] }), order.notes && (_jsxs("section", { style: sectionStyle, children: [_jsx("h3", { children: "Notes" }), _jsx("p", { style: { whiteSpace: 'pre-wrap', color: '#374151' }, children: order.notes })] }))] }));
|
|
25
61
|
}
|
|
26
62
|
//# sourceMappingURL=OrderDetail.js.map
|