@hintergrund/worker 0.1.6 → 0.1.7
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/dist/api/cms/handlers/admin-users.handler.d.ts +8 -0
- package/dist/api/cms/handlers/admin-users.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/admin-users.handler.js +121 -0
- package/dist/api/cms/handlers/agent-conversations.handler.d.ts +7 -0
- package/dist/api/cms/handlers/agent-conversations.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/agent-conversations.handler.js +94 -0
- package/dist/api/cms/handlers/auth.handler.d.ts +0 -3
- package/dist/api/cms/handlers/auth.handler.d.ts.map +1 -1
- package/dist/api/cms/handlers/auth.handler.js +74 -153
- package/dist/api/cms/handlers/website-repo.handler.d.ts +8 -0
- package/dist/api/cms/handlers/website-repo.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/website-repo.handler.js +148 -0
- package/dist/api/cms/routes/index.d.ts.map +1 -1
- package/dist/api/cms/routes/index.js +16 -4
- package/dist/api/emails/handlers/campaigns.handler.d.ts +10 -23
- package/dist/api/emails/handlers/campaigns.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/campaigns.handler.js +164 -92
- package/dist/api/emails/handlers/invoice.handler.d.ts +5 -19
- package/dist/api/emails/handlers/invoice.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/invoice.handler.js +58 -340
- package/dist/api/emails/handlers/public.handler.d.ts +6 -29
- package/dist/api/emails/handlers/public.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/public.handler.js +150 -312
- package/dist/api/emails/handlers/send.handler.d.ts +5 -17
- package/dist/api/emails/handlers/send.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/send.handler.js +107 -92
- package/dist/api/emails/handlers/settings.handler.d.ts +28 -33
- package/dist/api/emails/handlers/settings.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/settings.handler.js +96 -287
- package/dist/api/emails/handlers/subscribers.handler.d.ts +13 -0
- package/dist/api/emails/handlers/subscribers.handler.d.ts.map +1 -0
- package/dist/api/emails/handlers/subscribers.handler.js +125 -0
- package/dist/api/emails/handlers/webhook.handler.d.ts +1 -2
- package/dist/api/emails/handlers/webhook.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/webhook.handler.js +66 -166
- package/dist/api/emails/routes/admin.routes.d.ts +1 -3
- package/dist/api/emails/routes/admin.routes.d.ts.map +1 -1
- package/dist/api/emails/routes/admin.routes.js +19 -49
- package/dist/api/emails/routes/public.routes.d.ts +1 -3
- package/dist/api/emails/routes/public.routes.d.ts.map +1 -1
- package/dist/api/emails/routes/public.routes.js +2 -9
- package/dist/api/shop/handlers/prices.handler.d.ts +2 -15
- package/dist/api/shop/handlers/prices.handler.d.ts.map +1 -1
- package/dist/api/shop/handlers/prices.handler.js +2 -83
- package/dist/api/shop/handlers/products.handler.d.ts +29 -20
- package/dist/api/shop/handlers/products.handler.d.ts.map +1 -1
- package/dist/api/shop/handlers/products.handler.js +195 -162
- package/dist/api/shop/handlers/public.handler.d.ts +24 -8
- package/dist/api/shop/handlers/public.handler.d.ts.map +1 -1
- package/dist/api/shop/handlers/public.handler.js +525 -78
- package/dist/api/shop/routes.d.ts.map +1 -1
- package/dist/api/shop/routes.js +14 -9
- package/dist/hintergrund-assets.d.ts +3 -2
- package/dist/hintergrund-assets.d.ts.map +1 -1
- package/dist/hintergrund-assets.js +4 -2
- package/dist/index.d.ts +14 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -4
- package/dist/lib/auth/crypto.d.ts +2 -15
- package/dist/lib/auth/crypto.d.ts.map +1 -1
- package/dist/lib/auth/crypto.js +8 -95
- package/dist/lib/auth/jwt.d.ts +0 -4
- package/dist/lib/auth/jwt.d.ts.map +1 -1
- package/dist/lib/auth/jwt.js +0 -6
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +42 -86
- package/dist/lib/email-template.d.ts +15 -0
- package/dist/lib/email-template.d.ts.map +1 -0
- package/dist/lib/email-template.js +58 -0
- package/dist/lib/email.d.ts +18 -8
- package/dist/lib/email.d.ts.map +1 -1
- package/dist/lib/email.js +59 -70
- package/dist/lib/github-config.d.ts +19 -0
- package/dist/lib/github-config.d.ts.map +1 -0
- package/dist/lib/github-config.js +23 -0
- package/dist/lib/github.d.ts +10 -0
- package/dist/lib/github.d.ts.map +1 -1
- package/dist/lib/github.js +20 -2
- package/dist/lib/project-db.d.ts +24 -0
- package/dist/lib/project-db.d.ts.map +1 -0
- package/dist/lib/project-db.js +172 -0
- package/dist/lib/template.js +4 -4
- package/dist/middleware/auth.d.ts +0 -2
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +21 -50
- package/package.json +3 -2
- package/dist/api/builder/handlers/generate.handler.d.ts +0 -12
- package/dist/api/builder/handlers/generate.handler.d.ts.map +0 -1
- package/dist/api/builder/handlers/generate.handler.js +0 -203
- package/dist/api/builder/handlers/template.handler.d.ts +0 -12
- package/dist/api/builder/handlers/template.handler.d.ts.map +0 -1
- package/dist/api/builder/handlers/template.handler.js +0 -208
- package/dist/api/builder/routes.d.ts +0 -7
- package/dist/api/builder/routes.d.ts.map +0 -1
- package/dist/api/builder/routes.js +0 -15
- package/dist/api/cms/handlers/assets.handler.d.ts +0 -31
- package/dist/api/cms/handlers/assets.handler.d.ts.map +0 -1
- package/dist/api/cms/handlers/assets.handler.js +0 -200
- package/dist/api/cms/handlers/config.handler.d.ts +0 -7
- package/dist/api/cms/handlers/config.handler.d.ts.map +0 -1
- package/dist/api/cms/handlers/config.handler.js +0 -37
- package/dist/api/cms/handlers/content.handler.d.ts +0 -21
- package/dist/api/cms/handlers/content.handler.d.ts.map +0 -1
- package/dist/api/cms/handlers/content.handler.js +0 -117
- package/dist/api/cms/routes/assets.routes.d.ts +0 -4
- package/dist/api/cms/routes/assets.routes.d.ts.map +0 -1
- package/dist/api/cms/routes/assets.routes.js +0 -13
- package/dist/api/cms/routes/content.routes.d.ts +0 -4
- package/dist/api/cms/routes/content.routes.d.ts.map +0 -1
- package/dist/api/cms/routes/content.routes.js +0 -11
- package/dist/api/emails/handlers/branding.handler.d.ts +0 -17
- package/dist/api/emails/handlers/branding.handler.d.ts.map +0 -1
- package/dist/api/emails/handlers/branding.handler.js +0 -120
- package/dist/api/emails/handlers/contacts.handler.d.ts +0 -37
- package/dist/api/emails/handlers/contacts.handler.d.ts.map +0 -1
- package/dist/api/emails/handlers/contacts.handler.js +0 -161
- package/dist/api/emails/handlers/templates.handler.d.ts +0 -32
- package/dist/api/emails/handlers/templates.handler.d.ts.map +0 -1
- package/dist/api/emails/handlers/templates.handler.js +0 -132
- package/dist/api/newsletter/handlers/email.handler.d.ts +0 -7
- package/dist/api/newsletter/handlers/email.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/email.handler.js +0 -102
- package/dist/api/newsletter/handlers/emails.handler.d.ts +0 -31
- package/dist/api/newsletter/handlers/emails.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/emails.handler.js +0 -262
- package/dist/api/newsletter/handlers/invoice.handler.d.ts +0 -22
- package/dist/api/newsletter/handlers/invoice.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/invoice.handler.js +0 -455
- package/dist/api/newsletter/handlers/public.handler.d.ts +0 -22
- package/dist/api/newsletter/handlers/public.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/public.handler.js +0 -300
- package/dist/api/newsletter/handlers/send.handler.d.ts +0 -12
- package/dist/api/newsletter/handlers/send.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/send.handler.js +0 -153
- package/dist/api/newsletter/handlers/subscribers.handler.d.ts +0 -22
- package/dist/api/newsletter/handlers/subscribers.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/subscribers.handler.js +0 -195
- package/dist/api/newsletter/routes/admin.routes.d.ts +0 -4
- package/dist/api/newsletter/routes/admin.routes.d.ts.map +0 -1
- package/dist/api/newsletter/routes/admin.routes.js +0 -28
- package/dist/api/newsletter/routes/index.d.ts +0 -4
- package/dist/api/newsletter/routes/index.d.ts.map +0 -1
- package/dist/api/newsletter/routes/index.js +0 -9
- package/dist/api/newsletter/routes/public.routes.d.ts +0 -4
- package/dist/api/newsletter/routes/public.routes.d.ts.map +0 -1
- package/dist/api/newsletter/routes/public.routes.js +0 -9
- package/dist/api/shop/handlers/assets.handler.d.ts +0 -3
- package/dist/api/shop/handlers/assets.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/assets.handler.js +0 -62
- package/dist/api/shop/handlers/checkout.handler.d.ts +0 -10
- package/dist/api/shop/handlers/checkout.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/checkout.handler.js +0 -50
- package/dist/api/shop/handlers/customers.handler.d.ts +0 -17
- package/dist/api/shop/handlers/customers.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/customers.handler.js +0 -89
- package/dist/api/shop/handlers/orders.handler.d.ts +0 -17
- package/dist/api/shop/handlers/orders.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/orders.handler.js +0 -84
- package/dist/api/shop/handlers/stats.handler.d.ts +0 -10
- package/dist/api/shop/handlers/stats.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/stats.handler.js +0 -71
- package/dist/api/shop/handlers/webhook.handler.d.ts +0 -10
- package/dist/api/shop/handlers/webhook.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/webhook.handler.js +0 -233
- package/dist/cms-assets.d.ts +0 -4
- package/dist/cms-assets.d.ts.map +0 -1
- package/dist/cms-assets.js +0 -5
- package/dist/cms-bundle.d.ts +0 -3
- package/dist/cms-bundle.d.ts.map +0 -1
- package/dist/cms-bundle.js +0 -4
- package/dist/config-loader.d.ts +0 -26
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/config-loader.js +0 -98
- package/dist/jwt.d.ts +0 -26
- package/dist/jwt.d.ts.map +0 -1
- package/dist/jwt.js +0 -102
- package/dist/lib/plunk.d.ts +0 -204
- package/dist/lib/plunk.d.ts.map +0 -1
- package/dist/lib/plunk.js +0 -259
- package/dist/template.d.ts +0 -2
- package/dist/template.d.ts.map +0 -1
- package/dist/template.js +0 -61
- package/dist/utils.d.ts +0 -23
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -110
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
// Email validation
|
|
2
|
-
function isValidEmail(email) {
|
|
3
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
4
|
-
return emailRegex.test(email);
|
|
5
|
-
}
|
|
6
|
-
// Generate subscriber ID
|
|
7
|
-
function generateId() {
|
|
8
|
-
return Math.random().toString(36).substring(2, 14);
|
|
9
|
-
}
|
|
10
|
-
// Generate unsubscribe token
|
|
11
|
-
function generateToken() {
|
|
12
|
-
const array = new Uint8Array(32);
|
|
13
|
-
crypto.getRandomValues(array);
|
|
14
|
-
return Array.from(array, (b) => b.toString(16).padStart(2, '0')).join('');
|
|
15
|
-
}
|
|
16
|
-
// Parse D1 row to Subscriber
|
|
17
|
-
function parseSubscriber(row) {
|
|
18
|
-
return {
|
|
19
|
-
id: row.id,
|
|
20
|
-
email: row.email,
|
|
21
|
-
name: row.name || undefined,
|
|
22
|
-
status: row.status,
|
|
23
|
-
source: row.source,
|
|
24
|
-
confirmationToken: row.confirmation_token || undefined,
|
|
25
|
-
confirmationSentAt: row.confirmation_sent_at || undefined,
|
|
26
|
-
confirmedAt: row.confirmed_at || undefined,
|
|
27
|
-
subscribedAt: row.subscribed_at || undefined,
|
|
28
|
-
unsubscribedAt: row.unsubscribed_at || undefined,
|
|
29
|
-
unsubscribeToken: row.unsubscribe_token || undefined,
|
|
30
|
-
createdAt: row.created_at,
|
|
31
|
-
updatedAt: row.updated_at,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* GET /api/email/admin/subscribers
|
|
36
|
-
* Get all subscribers (admin only)
|
|
37
|
-
*/
|
|
38
|
-
export async function getSubscribers(c) {
|
|
39
|
-
try {
|
|
40
|
-
const db = c.env.DB;
|
|
41
|
-
const result = await db.prepare('SELECT * FROM subscribers ORDER BY created_at DESC').all();
|
|
42
|
-
const subscribers = result.results.map((row) => parseSubscriber(row));
|
|
43
|
-
return c.json({ subscribers });
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
console.error('Get subscribers error:', error);
|
|
47
|
-
return c.json({
|
|
48
|
-
success: false,
|
|
49
|
-
message: error instanceof Error ? error.message : 'Failed to fetch subscribers',
|
|
50
|
-
}, 500);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* POST /api/email/admin/subscribers
|
|
55
|
-
* Manually add subscriber (admin only, bypasses confirmation)
|
|
56
|
-
*/
|
|
57
|
-
export async function addSubscriber(c) {
|
|
58
|
-
try {
|
|
59
|
-
const body = (await c.req.json());
|
|
60
|
-
const { email, name } = body;
|
|
61
|
-
// Validate email
|
|
62
|
-
if (!email || !isValidEmail(email)) {
|
|
63
|
-
return c.json({ success: false, message: 'Invalid email address' }, 400);
|
|
64
|
-
}
|
|
65
|
-
const normalizedEmail = email.toLowerCase().trim();
|
|
66
|
-
const db = c.env.DB;
|
|
67
|
-
// Check for duplicates or unsubscribed
|
|
68
|
-
const existing = await db.prepare('SELECT id, status FROM subscribers WHERE email = ?').bind(normalizedEmail).first();
|
|
69
|
-
if (existing) {
|
|
70
|
-
// Block manual re-add of unsubscribed users
|
|
71
|
-
if (existing.status === 'unsubscribed') {
|
|
72
|
-
return c.json({
|
|
73
|
-
success: false,
|
|
74
|
-
message: 'This user has unsubscribed. They can only re-subscribe via the public subscription form.'
|
|
75
|
-
}, 403);
|
|
76
|
-
}
|
|
77
|
-
return c.json({ success: false, message: 'Subscriber already exists' }, 409);
|
|
78
|
-
}
|
|
79
|
-
// Create new subscriber with 'subscribed' status (bypass confirmation)
|
|
80
|
-
const id = generateId();
|
|
81
|
-
const unsubscribeToken = generateToken();
|
|
82
|
-
const now = Date.now();
|
|
83
|
-
await db
|
|
84
|
-
.prepare(`INSERT INTO subscribers
|
|
85
|
-
(id, email, name, status, source, unsubscribe_token, subscribed_at, created_at, updated_at)
|
|
86
|
-
VALUES (?, ?, ?, 'subscribed', 'manual', ?, ?, ?, ?)`)
|
|
87
|
-
.bind(id, normalizedEmail, name || null, unsubscribeToken, now, now, now)
|
|
88
|
-
.run();
|
|
89
|
-
// Fetch the created subscriber
|
|
90
|
-
const row = await db.prepare('SELECT * FROM subscribers WHERE id = ?').bind(id).first();
|
|
91
|
-
if (!row) {
|
|
92
|
-
return c.json({ success: false, message: 'Failed to create subscriber' }, 500);
|
|
93
|
-
}
|
|
94
|
-
const subscriber = parseSubscriber(row);
|
|
95
|
-
return c.json({ success: true, subscriber });
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
console.error('Add subscriber error:', error);
|
|
99
|
-
return c.json({
|
|
100
|
-
success: false,
|
|
101
|
-
message: error instanceof Error ? error.message : 'Failed to add subscriber',
|
|
102
|
-
}, 500);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* DELETE /api/email/admin/subscribers/:id
|
|
107
|
-
* Delete subscriber by ID (admin only)
|
|
108
|
-
*/
|
|
109
|
-
export async function deleteSubscriber(c) {
|
|
110
|
-
try {
|
|
111
|
-
const id = c.req.param('id');
|
|
112
|
-
if (!id) {
|
|
113
|
-
return c.json({ success: false, message: 'Missing subscriber ID' }, 400);
|
|
114
|
-
}
|
|
115
|
-
const db = c.env.DB;
|
|
116
|
-
// Check if subscriber exists
|
|
117
|
-
const existing = await db.prepare('SELECT id FROM subscribers WHERE id = ?').bind(id).first();
|
|
118
|
-
if (!existing) {
|
|
119
|
-
return c.json({ success: false, message: 'Subscriber not found' }, 404);
|
|
120
|
-
}
|
|
121
|
-
// Delete subscriber
|
|
122
|
-
await db.prepare('DELETE FROM subscribers WHERE id = ?').bind(id).run();
|
|
123
|
-
return c.json({ success: true });
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
console.error('Delete subscriber error:', error);
|
|
127
|
-
return c.json({
|
|
128
|
-
success: false,
|
|
129
|
-
message: error instanceof Error ? error.message : 'Failed to delete subscriber',
|
|
130
|
-
}, 500);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* PATCH /api/email/admin/subscribers/:id
|
|
135
|
-
* Update subscriber (admin only)
|
|
136
|
-
*/
|
|
137
|
-
export async function updateSubscriber(c) {
|
|
138
|
-
try {
|
|
139
|
-
const id = c.req.param('id');
|
|
140
|
-
if (!id) {
|
|
141
|
-
return c.json({ success: false, message: 'Missing subscriber ID' }, 400);
|
|
142
|
-
}
|
|
143
|
-
const body = (await c.req.json());
|
|
144
|
-
const db = c.env.DB;
|
|
145
|
-
// Check if subscriber exists
|
|
146
|
-
const existing = await db.prepare('SELECT id FROM subscribers WHERE id = ?').bind(id).first();
|
|
147
|
-
if (!existing) {
|
|
148
|
-
return c.json({ success: false, message: 'Subscriber not found' }, 404);
|
|
149
|
-
}
|
|
150
|
-
// Build update query dynamically
|
|
151
|
-
const updates = [];
|
|
152
|
-
const params = [];
|
|
153
|
-
if (body.name !== undefined) {
|
|
154
|
-
updates.push('name = ?');
|
|
155
|
-
params.push(body.name || null);
|
|
156
|
-
}
|
|
157
|
-
if (body.status !== undefined) {
|
|
158
|
-
updates.push('status = ?');
|
|
159
|
-
params.push(body.status);
|
|
160
|
-
// Update status timestamps
|
|
161
|
-
if (body.status === 'subscribed') {
|
|
162
|
-
updates.push('subscribed_at = ?');
|
|
163
|
-
params.push(Date.now());
|
|
164
|
-
}
|
|
165
|
-
else if (body.status === 'unsubscribed') {
|
|
166
|
-
updates.push('unsubscribed_at = ?');
|
|
167
|
-
params.push(Date.now());
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
// Always update updated_at
|
|
171
|
-
updates.push('updated_at = ?');
|
|
172
|
-
params.push(Date.now());
|
|
173
|
-
if (updates.length === 0) {
|
|
174
|
-
return c.json({ success: false, message: 'No fields to update' }, 400);
|
|
175
|
-
}
|
|
176
|
-
// Add ID to params
|
|
177
|
-
params.push(id);
|
|
178
|
-
const query = `UPDATE subscribers SET ${updates.join(', ')} WHERE id = ?`;
|
|
179
|
-
await db.prepare(query).bind(...params).run();
|
|
180
|
-
// Fetch updated subscriber
|
|
181
|
-
const row = await db.prepare('SELECT * FROM subscribers WHERE id = ?').bind(id).first();
|
|
182
|
-
if (!row) {
|
|
183
|
-
return c.json({ success: false, message: 'Failed to update subscriber' }, 500);
|
|
184
|
-
}
|
|
185
|
-
const subscriber = parseSubscriber(row);
|
|
186
|
-
return c.json({ success: true, subscriber });
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
console.error('Update subscriber error:', error);
|
|
190
|
-
return c.json({
|
|
191
|
-
success: false,
|
|
192
|
-
message: error instanceof Error ? error.message : 'Failed to update subscriber',
|
|
193
|
-
}, 500);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin.routes.d.ts","sourceRoot":"","sources":["../../../../src/api/newsletter/routes/admin.routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAO5B,QAAA,MAAM,WAAW,4EAAa,CAAC;AA4B/B,eAAe,WAAW,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Hono } from 'hono';
|
|
2
|
-
import { authMiddleware } from '../../../middleware/auth';
|
|
3
|
-
import { getSubscribers, addSubscriber, deleteSubscriber, updateSubscriber } from '../handlers/subscribers.handler';
|
|
4
|
-
import { sendBulkEmail, sendTestEmail } from '../handlers/send.handler';
|
|
5
|
-
import { getEmails, saveDraft, deleteEmail, getTemplate, saveTemplate } from '../handlers/emails.handler';
|
|
6
|
-
import { getInvoiceTemplate, saveInvoiceTemplate } from '../handlers/invoice.handler';
|
|
7
|
-
const adminRoutes = new Hono();
|
|
8
|
-
// Protect all admin routes with authentication
|
|
9
|
-
adminRoutes.use('*', authMiddleware);
|
|
10
|
-
// Admin subscriber management endpoints
|
|
11
|
-
adminRoutes.get('/subscribers', getSubscribers);
|
|
12
|
-
adminRoutes.post('/subscribers', addSubscriber);
|
|
13
|
-
adminRoutes.delete('/subscribers/:id', deleteSubscriber);
|
|
14
|
-
adminRoutes.patch('/subscribers/:id', updateSubscriber);
|
|
15
|
-
// Admin email sending endpoint
|
|
16
|
-
adminRoutes.post('/send', sendBulkEmail);
|
|
17
|
-
// Admin email history/drafts endpoints
|
|
18
|
-
adminRoutes.get('/emails', getEmails);
|
|
19
|
-
adminRoutes.post('/emails/draft', saveDraft);
|
|
20
|
-
adminRoutes.post('/emails/test', sendTestEmail);
|
|
21
|
-
adminRoutes.delete('/emails/:id', deleteEmail);
|
|
22
|
-
// Admin template settings endpoints
|
|
23
|
-
adminRoutes.get('/template', getTemplate);
|
|
24
|
-
adminRoutes.put('/template', saveTemplate);
|
|
25
|
-
// Admin invoice template endpoints
|
|
26
|
-
adminRoutes.get('/invoice-template', getInvoiceTemplate);
|
|
27
|
-
adminRoutes.put('/invoice-template', saveInvoiceTemplate);
|
|
28
|
-
export default adminRoutes;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/newsletter/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,QAAA,MAAM,gBAAgB,4EAAa,CAAC;AAQpC,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Hono } from 'hono';
|
|
2
|
-
import publicRoutes from './public.routes';
|
|
3
|
-
import adminRoutes from './admin.routes';
|
|
4
|
-
const newsletterRoutes = new Hono();
|
|
5
|
-
// Mount public routes (no /admin prefix)
|
|
6
|
-
newsletterRoutes.route('/', publicRoutes);
|
|
7
|
-
// Mount admin routes (with /admin prefix)
|
|
8
|
-
newsletterRoutes.route('/admin', adminRoutes);
|
|
9
|
-
export default newsletterRoutes;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public.routes.d.ts","sourceRoot":"","sources":["../../../../src/api/newsletter/routes/public.routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,QAAA,MAAM,YAAY,4EAAa,CAAC;AAQhC,eAAe,YAAY,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Hono } from 'hono';
|
|
2
|
-
import { subscribe, confirm, unsubscribe, showUnsubscribePage } from '../handlers/public.handler';
|
|
3
|
-
const publicRoutes = new Hono();
|
|
4
|
-
// Public newsletter endpoints (no authentication required)
|
|
5
|
-
publicRoutes.post('/subscribe', subscribe);
|
|
6
|
-
publicRoutes.get('/confirm', confirm);
|
|
7
|
-
publicRoutes.get('/unsubscribe', showUnsubscribePage);
|
|
8
|
-
publicRoutes.post('/unsubscribe', unsubscribe);
|
|
9
|
-
export default publicRoutes;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.handler.d.ts","sourceRoot":"","sources":["../../../../src/api/shop/handlers/assets.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAI/B,wBAAsB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAwEnE"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import Stripe from 'stripe';
|
|
2
|
-
import { getShopConfig } from '../../../lib/config';
|
|
3
|
-
export async function uploadShopAsset(c) {
|
|
4
|
-
try {
|
|
5
|
-
const config = getShopConfig(c.env);
|
|
6
|
-
const stripe = new Stripe(config.stripeSecretKey, {
|
|
7
|
-
apiVersion: '2025-02-24.acacia'
|
|
8
|
-
});
|
|
9
|
-
const { file, content, mimeType } = await c.req.json();
|
|
10
|
-
const filename = file || (await c.req.json()).name;
|
|
11
|
-
if (!filename || !content) {
|
|
12
|
-
return new Response('Missing filename or content', { status: 400 });
|
|
13
|
-
}
|
|
14
|
-
// Convert base64 to Uint8Array/Blob for Stripe
|
|
15
|
-
const binaryString = atob(content);
|
|
16
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
17
|
-
for (let i = 0; i < binaryString.length; i++) {
|
|
18
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
19
|
-
}
|
|
20
|
-
const fileObject = new File([bytes], filename, { type: mimeType });
|
|
21
|
-
// Upload to Stripe Files API
|
|
22
|
-
const stripeFile = await stripe.files.create({
|
|
23
|
-
file: {
|
|
24
|
-
data: bytes,
|
|
25
|
-
name: filename,
|
|
26
|
-
type: mimeType
|
|
27
|
-
},
|
|
28
|
-
purpose: 'product_image'
|
|
29
|
-
});
|
|
30
|
-
// Create a public file link so the image is accessible
|
|
31
|
-
const fileLink = await stripe.fileLinks.create({
|
|
32
|
-
file: stripeFile.id
|
|
33
|
-
});
|
|
34
|
-
const url = fileLink.url;
|
|
35
|
-
console.log('[Upload] Stripe File ID:', stripeFile.id);
|
|
36
|
-
console.log('[Upload] Generated URL:', url);
|
|
37
|
-
console.log('[Upload] File Type:', mimeType);
|
|
38
|
-
console.log('[Upload] Original Name:', filename);
|
|
39
|
-
if (!url) {
|
|
40
|
-
throw new Error('Failed to get URL from Stripe File upload');
|
|
41
|
-
}
|
|
42
|
-
return new Response(JSON.stringify({
|
|
43
|
-
success: true,
|
|
44
|
-
url,
|
|
45
|
-
message: `Uploaded ${filename} to Stripe`
|
|
46
|
-
}), {
|
|
47
|
-
status: 200,
|
|
48
|
-
headers: {
|
|
49
|
-
'Content-Type': 'application/json'
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
console.error('Shop asset upload error:', error);
|
|
55
|
-
return new Response(JSON.stringify({ error: error instanceof Error ? error.message : String(error) }), {
|
|
56
|
-
status: 500,
|
|
57
|
-
headers: {
|
|
58
|
-
'Content-Type': 'application/json'
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import type { Bindings } from '../../../index';
|
|
3
|
-
/**
|
|
4
|
-
* POST /api/shop/checkout
|
|
5
|
-
* Create a Stripe Checkout Session
|
|
6
|
-
*/
|
|
7
|
-
export declare function createCheckoutSession(c: Context<{
|
|
8
|
-
Bindings: Bindings;
|
|
9
|
-
}>): Promise<Response>;
|
|
10
|
-
//# sourceMappingURL=checkout.handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.handler.d.ts","sourceRoot":"","sources":["../../../../src/api/shop/handlers/checkout.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAW/C;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAAE,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CA8CjG"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { getShopConfig } from '../../../lib/config';
|
|
2
|
-
import Stripe from 'stripe';
|
|
3
|
-
function getStripe(env) {
|
|
4
|
-
const config = getShopConfig(env);
|
|
5
|
-
return new Stripe(config.stripeSecretKey, {
|
|
6
|
-
apiVersion: '2025-02-24.acacia'
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* POST /api/shop/checkout
|
|
11
|
-
* Create a Stripe Checkout Session
|
|
12
|
-
*/
|
|
13
|
-
export async function createCheckoutSession(c) {
|
|
14
|
-
try {
|
|
15
|
-
const stripe = getStripe(c.env);
|
|
16
|
-
const body = await c.req.json();
|
|
17
|
-
const { priceId, quantity = 1, successUrl, cancelUrl, customerEmail, metadata, mode = 'payment' } = body;
|
|
18
|
-
const items = body.items || [];
|
|
19
|
-
if (priceId) {
|
|
20
|
-
items.push({ priceId, quantity });
|
|
21
|
-
}
|
|
22
|
-
if (items.length === 0) {
|
|
23
|
-
return c.json({ success: false, error: 'No items provided' }, 400);
|
|
24
|
-
}
|
|
25
|
-
if (!successUrl || !cancelUrl) {
|
|
26
|
-
return c.json({ success: false, error: 'Missing successUrl or cancelUrl' }, 400);
|
|
27
|
-
}
|
|
28
|
-
const lineItems = items.map((item) => ({
|
|
29
|
-
price: item.priceId,
|
|
30
|
-
quantity: item.quantity,
|
|
31
|
-
}));
|
|
32
|
-
const sessionParams = {
|
|
33
|
-
line_items: lineItems,
|
|
34
|
-
mode: mode,
|
|
35
|
-
success_url: successUrl,
|
|
36
|
-
cancel_url: cancelUrl,
|
|
37
|
-
customer_email: customerEmail,
|
|
38
|
-
metadata: metadata,
|
|
39
|
-
allow_promotion_codes: true,
|
|
40
|
-
};
|
|
41
|
-
// If customer is logged in or provided, we could attach it.
|
|
42
|
-
// For now, simple checkout.
|
|
43
|
-
const session = await stripe.checkout.sessions.create(sessionParams);
|
|
44
|
-
return c.json({ url: session.url, sessionId: session.id });
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
console.error('Checkout error:', error);
|
|
48
|
-
return c.json({ success: false, error: error.message }, 500);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import type { Bindings } from '../../../index';
|
|
3
|
-
/**
|
|
4
|
-
* GET /api/shop/admin/customers
|
|
5
|
-
* List all customers
|
|
6
|
-
*/
|
|
7
|
-
export declare function getCustomers(c: Context<{
|
|
8
|
-
Bindings: Bindings;
|
|
9
|
-
}>): Promise<Response>;
|
|
10
|
-
/**
|
|
11
|
-
* GET /api/shop/admin/customers/:id
|
|
12
|
-
* Get a single customer with their orders
|
|
13
|
-
*/
|
|
14
|
-
export declare function getCustomer(c: Context<{
|
|
15
|
-
Bindings: Bindings;
|
|
16
|
-
}>): Promise<Response>;
|
|
17
|
-
//# sourceMappingURL=customers.handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customers.handler.d.ts","sourceRoot":"","sources":["../../../../src/api/shop/handlers/customers.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA4B/C;;;GAGG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoBxF;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkDvF"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { getShopConfig } from '../../../lib/config';
|
|
2
|
-
import Stripe from 'stripe';
|
|
3
|
-
function getStripe(env) {
|
|
4
|
-
const config = getShopConfig(env);
|
|
5
|
-
return new Stripe(config.stripeSecretKey, {
|
|
6
|
-
apiVersion: '2025-02-24.acacia'
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function mapStripeCustomer(customer) {
|
|
10
|
-
return {
|
|
11
|
-
id: customer.id,
|
|
12
|
-
email: customer.email,
|
|
13
|
-
name: customer.name || null,
|
|
14
|
-
phone: customer.phone || null,
|
|
15
|
-
description: customer.description,
|
|
16
|
-
metadata: customer.metadata || {},
|
|
17
|
-
createdAt: customer.created
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* GET /api/shop/admin/customers
|
|
22
|
-
* List all customers
|
|
23
|
-
*/
|
|
24
|
-
export async function getCustomers(c) {
|
|
25
|
-
try {
|
|
26
|
-
const stripe = getStripe(c.env);
|
|
27
|
-
const limit = parseInt(c.req.query('limit') || '25');
|
|
28
|
-
const customers = await stripe.customers.list({
|
|
29
|
-
limit
|
|
30
|
-
});
|
|
31
|
-
const response = {
|
|
32
|
-
customers: customers.data.map(mapStripeCustomer),
|
|
33
|
-
hasMore: customers.has_more
|
|
34
|
-
};
|
|
35
|
-
return c.json(response);
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.error('Failed to fetch customers:', error);
|
|
39
|
-
return c.json({ success: false, error: 'Failed to fetch customers' }, 500);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* GET /api/shop/admin/customers/:id
|
|
44
|
-
* Get a single customer with their orders
|
|
45
|
-
*/
|
|
46
|
-
export async function getCustomer(c) {
|
|
47
|
-
try {
|
|
48
|
-
const stripe = getStripe(c.env);
|
|
49
|
-
const customerId = c.req.param('id');
|
|
50
|
-
const [customer, paymentIntents] = await Promise.all([
|
|
51
|
-
stripe.customers.retrieve(customerId),
|
|
52
|
-
stripe.paymentIntents.list({
|
|
53
|
-
customer: customerId,
|
|
54
|
-
limit: 100
|
|
55
|
-
})
|
|
56
|
-
]);
|
|
57
|
-
if (customer.deleted) {
|
|
58
|
-
return c.json({ success: false, error: 'Customer not found' }, 404);
|
|
59
|
-
}
|
|
60
|
-
const mappedCustomer = mapStripeCustomer(customer);
|
|
61
|
-
// Calculate totals
|
|
62
|
-
mappedCustomer.totalOrders = paymentIntents.data.filter((pi) => pi.status === 'succeeded').length;
|
|
63
|
-
mappedCustomer.totalSpent = paymentIntents.data
|
|
64
|
-
.filter((pi) => pi.status === 'succeeded')
|
|
65
|
-
.reduce((sum, pi) => sum + pi.amount_received, 0);
|
|
66
|
-
const response = {
|
|
67
|
-
customer: mappedCustomer,
|
|
68
|
-
orders: paymentIntents.data.map((pi) => ({
|
|
69
|
-
id: pi.id,
|
|
70
|
-
customerId: customerId,
|
|
71
|
-
customerEmail: customer.email || null,
|
|
72
|
-
customerName: customer.name || null,
|
|
73
|
-
amount: pi.amount,
|
|
74
|
-
amountReceived: pi.amount_received,
|
|
75
|
-
currency: pi.currency,
|
|
76
|
-
status: pi.status,
|
|
77
|
-
paymentMethod: typeof pi.payment_method === 'string' ? pi.payment_method : pi.payment_method?.id || null,
|
|
78
|
-
lineItems: [],
|
|
79
|
-
metadata: pi.metadata || {},
|
|
80
|
-
createdAt: pi.created
|
|
81
|
-
}))
|
|
82
|
-
};
|
|
83
|
-
return c.json(response);
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
console.error('Failed to fetch customer:', error);
|
|
87
|
-
return c.json({ success: false, error: 'Failed to fetch customer' }, 500);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import type { Bindings } from '../../../index';
|
|
3
|
-
/**
|
|
4
|
-
* GET /api/shop/admin/orders
|
|
5
|
-
* List payment intents (orders)
|
|
6
|
-
*/
|
|
7
|
-
export declare function getOrders(c: Context<{
|
|
8
|
-
Bindings: Bindings;
|
|
9
|
-
}>): Promise<Response>;
|
|
10
|
-
/**
|
|
11
|
-
* GET /api/shop/admin/orders/:id
|
|
12
|
-
* Get a single order
|
|
13
|
-
*/
|
|
14
|
-
export declare function getOrder(c: Context<{
|
|
15
|
-
Bindings: Bindings;
|
|
16
|
-
}>): Promise<Response>;
|
|
17
|
-
//# sourceMappingURL=orders.handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orders.handler.d.ts","sourceRoot":"","sources":["../../../../src/api/shop/handlers/orders.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAsC/C;;;GAGG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkCrF;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAsBpF"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { getShopConfig } from '../../../lib/config';
|
|
2
|
-
import Stripe from 'stripe';
|
|
3
|
-
function getStripe(env) {
|
|
4
|
-
const config = getShopConfig(env);
|
|
5
|
-
return new Stripe(config.stripeSecretKey, {
|
|
6
|
-
apiVersion: '2025-02-24.acacia'
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function mapPaymentIntentStatus(status) {
|
|
10
|
-
return status;
|
|
11
|
-
}
|
|
12
|
-
function mapPaymentIntent(pi) {
|
|
13
|
-
return {
|
|
14
|
-
id: pi.id,
|
|
15
|
-
customerId: typeof pi.customer === 'string' ? pi.customer : pi.customer?.id || null,
|
|
16
|
-
customerEmail: pi.receipt_email || null,
|
|
17
|
-
customerName: null,
|
|
18
|
-
amount: pi.amount,
|
|
19
|
-
amountReceived: pi.amount_received,
|
|
20
|
-
currency: pi.currency,
|
|
21
|
-
status: mapPaymentIntentStatus(pi.status),
|
|
22
|
-
paymentMethod: typeof pi.payment_method === 'string' ? pi.payment_method : pi.payment_method?.id || null,
|
|
23
|
-
lineItems: [],
|
|
24
|
-
metadata: pi.metadata || {},
|
|
25
|
-
createdAt: pi.created
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* GET /api/shop/admin/orders
|
|
30
|
-
* List payment intents (orders)
|
|
31
|
-
*/
|
|
32
|
-
export async function getOrders(c) {
|
|
33
|
-
try {
|
|
34
|
-
const stripe = getStripe(c.env);
|
|
35
|
-
const limit = parseInt(c.req.query('limit') || '25');
|
|
36
|
-
const paymentIntents = await stripe.paymentIntents.list({
|
|
37
|
-
limit,
|
|
38
|
-
expand: ['data.customer']
|
|
39
|
-
});
|
|
40
|
-
const orders = paymentIntents.data.map((pi) => {
|
|
41
|
-
const order = mapPaymentIntent(pi);
|
|
42
|
-
// Add customer info if expanded
|
|
43
|
-
if (pi.customer && typeof pi.customer !== 'string' && !pi.customer.deleted) {
|
|
44
|
-
const customer = pi.customer;
|
|
45
|
-
order.customerEmail = customer.email || order.customerEmail;
|
|
46
|
-
order.customerName = customer.name || null;
|
|
47
|
-
}
|
|
48
|
-
return order;
|
|
49
|
-
});
|
|
50
|
-
const response = {
|
|
51
|
-
orders,
|
|
52
|
-
hasMore: paymentIntents.has_more
|
|
53
|
-
};
|
|
54
|
-
return c.json(response);
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
console.error('Failed to fetch orders:', error);
|
|
58
|
-
return c.json({ success: false, error: 'Failed to fetch orders' }, 500);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* GET /api/shop/admin/orders/:id
|
|
63
|
-
* Get a single order
|
|
64
|
-
*/
|
|
65
|
-
export async function getOrder(c) {
|
|
66
|
-
try {
|
|
67
|
-
const stripe = getStripe(c.env);
|
|
68
|
-
const orderId = c.req.param('id');
|
|
69
|
-
const paymentIntent = await stripe.paymentIntents.retrieve(orderId, {
|
|
70
|
-
expand: ['customer']
|
|
71
|
-
});
|
|
72
|
-
const order = mapPaymentIntent(paymentIntent);
|
|
73
|
-
if (paymentIntent.customer && typeof paymentIntent.customer !== 'string' && !paymentIntent.customer.deleted) {
|
|
74
|
-
const customer = paymentIntent.customer;
|
|
75
|
-
order.customerEmail = customer.email || order.customerEmail;
|
|
76
|
-
order.customerName = customer.name || null;
|
|
77
|
-
}
|
|
78
|
-
return c.json({ order });
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
console.error('Failed to fetch order:', error);
|
|
82
|
-
return c.json({ success: false, error: 'Failed to fetch order' }, 500);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import type { Bindings } from '../../../index';
|
|
3
|
-
/**
|
|
4
|
-
* GET /api/shop/admin/stats
|
|
5
|
-
* Get shop statistics
|
|
6
|
-
*/
|
|
7
|
-
export declare function getStats(c: Context<{
|
|
8
|
-
Bindings: Bindings;
|
|
9
|
-
}>): Promise<Response>;
|
|
10
|
-
//# sourceMappingURL=stats.handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.handler.d.ts","sourceRoot":"","sources":["../../../../src/api/shop/handlers/stats.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAY/C;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAwEpF"}
|