server-core-module 1.0.4 → 1.0.6
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.
|
@@ -16,7 +16,7 @@ async function sendOrderConfirmation(email, name, items, totalAmount, deliveryFe
|
|
|
16
16
|
<td>₱${item.price * item.quantity}</td>
|
|
17
17
|
</tr>`).join("");
|
|
18
18
|
resend.emails.send({
|
|
19
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
19
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
20
20
|
to: email,
|
|
21
21
|
subject: "Order Received! 🌸",
|
|
22
22
|
html: `
|
|
@@ -47,7 +47,7 @@ async function sendOrderConfirmation(email, name, items, totalAmount, deliveryFe
|
|
|
47
47
|
async function sendOrderStatusUpdate(email, name, status) {
|
|
48
48
|
try {
|
|
49
49
|
resend.emails.send({
|
|
50
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
50
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
51
51
|
to: email,
|
|
52
52
|
subject: `Order ${status}! 🌸`,
|
|
53
53
|
html: `
|
|
@@ -72,7 +72,7 @@ async function sendAdminNotification(name, items, totalAmount, customerEmail, de
|
|
|
72
72
|
<td>₱${item.price * item.quantity}</td>
|
|
73
73
|
</tr>`).join("");
|
|
74
74
|
resend.emails.send({
|
|
75
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
75
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
76
76
|
to: process.env.ADMIN_EMAIL,
|
|
77
77
|
subject: `New Order from ${name}! 🌸`,
|
|
78
78
|
html: `
|
|
@@ -112,7 +112,7 @@ async function sendAdminNotification(name, items, totalAmount, customerEmail, de
|
|
|
112
112
|
async function sendContactEmail(name, email, phone, eventType, message) {
|
|
113
113
|
try {
|
|
114
114
|
resend.emails.send({
|
|
115
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
115
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
116
116
|
to: process.env.ADMIN_EMAIL,
|
|
117
117
|
subject: `New Inquiry from ${name} - ${eventType} 🌸`,
|
|
118
118
|
html: `
|
|
@@ -126,7 +126,7 @@ async function sendContactEmail(name, email, phone, eventType, message) {
|
|
|
126
126
|
`,
|
|
127
127
|
});
|
|
128
128
|
resend.emails.send({
|
|
129
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
129
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
130
130
|
to: email,
|
|
131
131
|
subject: `We received your message! 🌸`,
|
|
132
132
|
html: `
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ export type TOrder = {
|
|
|
12
12
|
name: string;
|
|
13
13
|
price: number;
|
|
14
14
|
quantity: number;
|
|
15
|
+
note?: string;
|
|
15
16
|
}[];
|
|
16
17
|
totalAmount: number;
|
|
17
18
|
note?: string;
|
|
@@ -33,6 +34,7 @@ export const schemaOrder = Joi.object({
|
|
|
33
34
|
name: Joi.string().required(),
|
|
34
35
|
price: Joi.number().min(0).required(),
|
|
35
36
|
quantity: Joi.number().min(1).required(),
|
|
37
|
+
note: Joi.string().optional().allow(''),
|
|
36
38
|
})).required(),
|
|
37
39
|
totalAmount: Joi.number().min(0).required(),
|
|
38
40
|
note: Joi.string().optional(),
|
|
@@ -53,6 +55,7 @@ export const schemaOrderUpdate = Joi.object({
|
|
|
53
55
|
name: Joi.string().required(),
|
|
54
56
|
price: Joi.number().min(0).required(),
|
|
55
57
|
quantity: Joi.number().min(1).required(),
|
|
58
|
+
note: Joi.string().optional().allow(''),
|
|
56
59
|
})),
|
|
57
60
|
totalAmount: Joi.number().min(0),
|
|
58
61
|
note: Joi.string(),
|
|
@@ -6,16 +6,17 @@ export async function sendOrderConfirmation(email: string, name: string, items:
|
|
|
6
6
|
try {
|
|
7
7
|
|
|
8
8
|
const itemsList = items.map(item =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
`<tr>
|
|
10
|
+
<td>${item.name}</td>
|
|
11
|
+
<td>${item.quantity}</td>
|
|
12
|
+
<td>₱${item.price}</td>
|
|
13
|
+
<td>₱${item.price * item.quantity}</td>
|
|
14
|
+
<td>${item.note || '-'}</td>
|
|
15
|
+
</tr>`
|
|
16
|
+
).join("");
|
|
16
17
|
|
|
17
18
|
resend.emails.send({
|
|
18
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
19
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
19
20
|
to: email,
|
|
20
21
|
subject: "Order Received! 🌸",
|
|
21
22
|
html: `
|
|
@@ -27,6 +28,7 @@ export async function sendOrderConfirmation(email: string, name: string, items:
|
|
|
27
28
|
<th>Qty</th>
|
|
28
29
|
<th>Price</th>
|
|
29
30
|
<th>Subtotal</th>
|
|
31
|
+
<th>Note</th>
|
|
30
32
|
</tr>
|
|
31
33
|
${itemsList}
|
|
32
34
|
</table>
|
|
@@ -47,7 +49,7 @@ export async function sendOrderStatusUpdate(email: string, name: string, status:
|
|
|
47
49
|
try {
|
|
48
50
|
|
|
49
51
|
resend.emails.send({
|
|
50
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
52
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
51
53
|
to: email,
|
|
52
54
|
subject: `Order ${status}! 🌸`,
|
|
53
55
|
html: `
|
|
@@ -66,17 +68,18 @@ export async function sendOrderStatusUpdate(email: string, name: string, status:
|
|
|
66
68
|
export async function sendAdminNotification(name: string, items: any[], totalAmount: number, customerEmail: string, deliveryFee?:number) {
|
|
67
69
|
try {
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
const itemsList = items.map(item =>
|
|
72
|
+
`<tr>
|
|
73
|
+
<td>${item.name}</td>
|
|
74
|
+
<td>${item.quantity}</td>
|
|
75
|
+
<td>₱${item.price}</td>
|
|
76
|
+
<td>₱${item.price * item.quantity}</td>
|
|
77
|
+
<td>${item.note || '-'}</td>
|
|
78
|
+
</tr>`
|
|
79
|
+
).join("");
|
|
77
80
|
|
|
78
81
|
resend.emails.send({
|
|
79
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
82
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
80
83
|
to: process.env.ADMIN_EMAIL!,
|
|
81
84
|
subject: `New Order from ${name}! 🌸`,
|
|
82
85
|
html: `
|
|
@@ -89,18 +92,19 @@ export async function sendAdminNotification(name: string, items: any[], totalAmo
|
|
|
89
92
|
<th>Qty</th>
|
|
90
93
|
<th>Price</th>
|
|
91
94
|
<th>Subtotal</th>
|
|
95
|
+
<th>Note</th>
|
|
92
96
|
</tr>
|
|
93
97
|
${itemsList}
|
|
94
98
|
<tr>
|
|
95
|
-
<td colspan="
|
|
99
|
+
<td colspan="4"><strong>Items Subtotal</strong></td>
|
|
96
100
|
<td>₱${totalAmount - (deliveryFee || 0)}</td>
|
|
97
101
|
</tr>
|
|
98
102
|
<tr>
|
|
99
|
-
<td colspan="
|
|
103
|
+
<td colspan="4"><strong>Delivery Fee</strong></td>
|
|
100
104
|
<td>₱${deliveryFee || 0}</td>
|
|
101
105
|
</tr>
|
|
102
106
|
<tr>
|
|
103
|
-
<td colspan="
|
|
107
|
+
<td colspan="4"><strong>Total</strong></td>
|
|
104
108
|
<td><strong>₱${totalAmount}</strong></td>
|
|
105
109
|
</tr>
|
|
106
110
|
</table>
|
|
@@ -118,7 +122,7 @@ export async function sendContactEmail(name: string, email: string, phone: strin
|
|
|
118
122
|
|
|
119
123
|
|
|
120
124
|
resend.emails.send({
|
|
121
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
125
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
122
126
|
to: process.env.ADMIN_EMAIL!,
|
|
123
127
|
subject: `New Inquiry from ${name} - ${eventType} 🌸`,
|
|
124
128
|
html: `
|
|
@@ -133,7 +137,7 @@ export async function sendContactEmail(name: string, email: string, phone: strin
|
|
|
133
137
|
});
|
|
134
138
|
|
|
135
139
|
resend.emails.send({
|
|
136
|
-
from: "Cesar's Flower Shop 🌸 <
|
|
140
|
+
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
137
141
|
to: email,
|
|
138
142
|
subject: `We received your message! 🌸`,
|
|
139
143
|
html: `
|