Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
diboune committed Oct 23, 2024
1 parent 57f0fc4 commit f901c46
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ export default function EmailBody({
paragraphs,
signature,
}: EmailBodyProps) {
const greeting = firstName ? `Hi ${firstName},` : "Hi,";

return (
<Text className="mb-[50px]" style={body}>
Hi {firstName}, <br />
{greeting} <br />
{paragraphs.map((paragraph, index) => (
<span key={index} style={body}>
{paragraph}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export default function OrderConfirmation({ order }: { order: OrderDTO }) {
return (
<Layout preview="Order confirmation">
<Section className="w-full px-5 mb-12" align="left">
<Img src="https://cdn.sanity.io/images/1wtf7iqx/production/e04b80a29759293982d74afcde82a169505a3aaa-1166x112.png" />
<Img
className="max-w-[291px]"
src="https://cdn.sanity.io/images/1wtf7iqx/production/e04b80a29759293982d74afcde82a169505a3aaa-1166x112.png"
/>
<Heading className="mb-3 mt-20" style={title}>
Thank you for your order!
</Heading>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export default function ShippingConfirmation() {
return (
<Layout preview="Shipping confirmation">
<Section className="w-full max-w-[565px] mb-16 px-5" align="left">
<Img src="https://cdn.sanity.io/images/1wtf7iqx/production/e04b80a29759293982d74afcde82a169505a3aaa-1166x112.png" />
<Img
className="max-w-[291px]"
src="https://cdn.sanity.io/images/1wtf7iqx/production/e04b80a29759293982d74afcde82a169505a3aaa-1166x112.png"
/>
<Heading className="mb-3 mt-16" style={title}>
Your order is on its way!
</Heading>
Expand Down
2 changes: 1 addition & 1 deletion backend/src/api/store/email/_templates/welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function Welcome({ products }: { products: ProductDTO[] }) {
<Section className="w-full px-5 my-20" align="left">
<Img
src="https://cdn.sanity.io/images/1wtf7iqx/production/0ebbdf446bb2d4e4287c722fb82fe385d13d6dea-2400x1260.png"
className="rounded-lg mb-8"
className="rounded-lg mb-8 w-full max-w-[560px]"
/>
<Heading className="pb-3" style={title}>
Get ready for some sweet! 🍪
Expand Down
16 changes: 8 additions & 8 deletions backend/src/subscribers/newsletter-sub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ export default async function subscribeNewsletterHandler({
event.data.id,
);

const audiences = await resend.audiences.list();
// const audiences = await resend.audiences.list();

const audienceId = audiences.data?.data?.[0].id;
// const audienceId = audiences.data?.data?.[0].id;

if (!audienceId) throw new Error("No audience found");
// if (!audienceId) throw new Error("No audience found");

const { data, error } = await resend.contacts.create({
audienceId,
email: customer.email,
});
// const { data, error } = await resend.contacts.create({
// audienceId,
// email: customer.email,
// });

if (error) throw new Error("Error subscribing email");
// if (error) throw new Error("Error subscribing email");

const response = await fetch(
"https://munchies.medusajs.app/store/email/welcome/" + event.data.id,
Expand Down
2 changes: 1 addition & 1 deletion backend/src/workflows/subscribe-to-newsletter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const subscribeCustomerToNewsletter = createStep(
id: customer.id,
compensate: "created",
};
} else if (customer.metadata.newsletter) {
} else if (customer.metadata?.newsletter) {
response = {
id: customer.id,
compensate: "nothing",
Expand Down

0 comments on commit f901c46

Please sign in to comment.