+
{PAGE_TITLE_404}
} - {course && ( - <> -A new section is now available in ${product.title}.
- \nCheers!`, + ({ + ...defaultEmail, + content: [ + { + blockType: "text", + settings: { + content: "Hi {{ subscriber.name }},", + }, + }, + { + blockType: "text", + settings: { + content: + "A new section is now available in [{{product.title}}]({{product.url}})", + }, + }, + { + blockType: "text", + settings: { + content: + "{{address}}\n\n{{unsubscribe_link}}", + alignment: "center", + fontSize: "12px", + foregroundColor: "#64748b", + }, + }, + ], + } as EmailContent), ); setEmailSubject( group.drip?.email?.subject || @@ -157,7 +188,7 @@ export default function SectionPage() { await updateGroup(); - router.push(`/dashboard/product/${productId}/content`); + // router.push(`/dashboard/product/${productId}/content`); }; const updateGroup = async () => { @@ -181,8 +212,16 @@ export default function SectionPage() { delayInMillis, dateInUTC, email { - content, + content { + content { + blockType, + settings + }, + style, + meta + }, subject + emailId } } } @@ -206,7 +245,7 @@ export default function SectionPage() { email: notifyUsers ? { subject: emailSubject, - content: emailContent, + content: JSON.stringify(emailContent), } : undefined, } @@ -222,6 +261,11 @@ export default function SectionPage() { // router.replace( // `/dashboard/product/${productId}/content`, // ); + setEmailId( + response.course.groups.find( + (group) => group.id === sectionId, + )?.drip?.email?.emailId || "", + ); toast({ title: TOAST_TITLE_SUCCESS, description: TOAST_DESCRIPTION_CHANGES_SAVED, @@ -467,7 +511,7 @@ export default function SectionPage() { { notifyUsers && ( -Exit
+Exit
+
-
+ You can use the following variables in your content. +
++ These will be replaced with the actual data while + sending emails. +
++ {description} +
+Error: You might have forgotten to close a Liquid tag.
Check the variables you are using in the content.
", - ); - } - }; - - useEffect(() => { - renderEmail(); - }, [content]); - - return ( -- You can use the following variables in your content. -
-- These will be replaced with the actual data while - sending emails. -
-- The email of the subscriber -
-- The name of the subscriber -
-- Your mailing address -
-- A link to unsubscribe from the marketing emails -
-| {MAIL_TABLE_HEADER_SUBJECT} | -{MAIL_TABLE_HEADER_STATUS} | - {type === "sequence" && ( -{MAIL_TABLE_HEADER_ENTRANTS} | - )} -- - {type === "broadcast" && - (broadcast.emails[0].subject === " " - ? "--" - : broadcast.emails[0].subject)} - {type === "sequence" && - (broadcast.title === " " - ? "Untitled Sequence" - : broadcast.title)} - - | -
- {type === "broadcast" && (
- <>
- {broadcast.status ===
- Constants.sequenceStatus[1] &&
- !isDateInFuture(
- new Date(
- broadcast.emails[0].delayInMillis,
- ),
- ) && (
- |
+
| {broadcast.entrantsCount} | +
A new section is now available in ${course.title}.
- \nCheers!`, - ); - setEmailSubject( - group.drip?.email?.subject || - `A new section is now available in ${course.title}`, - ); - setStatus( - typeof group.drip?.status === "boolean" - ? group.drip?.status - : true, - ); - } - } - }, [course]); - - const updateGroup = async (e) => { - e.preventDefault(); - const query = section - ? ` - mutation updateGroup($id: ID!, $courseId: String!, $name: String, $drip: DripInput) { - course: updateGroup( - id: $id, - courseId: $courseId, - name: $name, - drip: $drip - ) { - courseId, - groups { - id, - name, - rank, - collapsed, - drip { - type, - status, - delayInMillis, - dateInUTC, - email { - content, - subject - } - } - } - } - } - ` - : ` - mutation addGroup($courseId: ID!, $name: String!) { - course: addGroup(id: $courseId, name: $name) { - courseId, - groups { - id, - name, - rank, - collapsed, - drip { - type, - status, - delayInMillis, - dateInUTC, - email { - content, - subject - } - } - } - } - } - `; - const fetch = new FetchBuilder() - .setUrl(`${address.backend}/api/graph`) - .setPayload({ - query, - variables: section - ? { - id: section, - courseId: course.courseId, - name, - drip: type - ? { - status, - type: type.toUpperCase().split("-")[0], - delayInMillis: delay, - dateInUTC: date, - email: notifyUsers - ? { - subject: emailSubject, - content: emailContent, - } - : undefined, - } - : undefined, - } - : { - courseId: course?.id, - name, - }, - }) - .setIsGraphQLEndpoint(true) - .build(); - try { - dispatch && dispatch(actionCreators.networkAction(true)); - const response = await fetch.exec(); - if (response.course) { - router.replace( - `/dashboard/product/${course?.courseId}?tab=Content`, - ); - } - } catch (err: any) { - toast({ - title: TOAST_TITLE_ERROR, - description: err.message, - variant: "destructive", - }); - } finally { - dispatch && dispatch(actionCreators.networkAction(false)); - } - }; - - if (!course) { - return ( -