diff --git a/apps/console/app/routes/apps/$clientId/designer.tsx b/apps/console/app/routes/apps/$clientId/designer.tsx index 6986f9dd2f..4bbfaecb46 100644 --- a/apps/console/app/routes/apps/$clientId/designer.tsx +++ b/apps/console/app/routes/apps/$clientId/designer.tsx @@ -930,6 +930,7 @@ const EmailPanel = ({ emailTheme, setLoading, errors, + passportURL, }: { clientId: string accountURN?: AccountURN @@ -940,6 +941,7 @@ const EmailPanel = ({ errors?: { [key: string]: string } + passportURL: string }) => { const [logoURL, setLogoURL] = useState( emailTheme?.logoURL @@ -1257,16 +1259,24 @@ const EmailPanel = ({ ref={iFrameRef} className="w-full border rounded-lg" srcDoc={ - EmailTemplateOTP('XXXXXX', { - appName: 'Designer', - logoURL: - logoURL ?? - 'https://imagedelivery.net/VqQy1abBMHYDZwVsTbsSMw/70676dfd-2899-4556-81ef-e5f48f5eb900/public', - privacyURL: '#', - termsURL: '#', - contactURL: contact, - address: address, - }).body + EmailTemplateOTP( + 'XXXXXX', + clientId, + appContactEmail ?? 'test@email.com', + 'none', + passportURL, + { + appName: 'Designer', + logoURL: + logoURL ?? + 'https://imagedelivery.net/VqQy1abBMHYDZwVsTbsSMw/70676dfd-2899-4556-81ef-e5f48f5eb900/public', + privacyURL: '#', + termsURL: '#', + contactURL: contact, + address: address, + }, + true + ).body } onLoad={(ev) => { const iFrame = ev.target as HTMLIFrameElement @@ -1502,6 +1512,7 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper( appTheme, emailTheme, ogTheme, + passportURL: context.env.PASSPORT_URL, }) } ) @@ -1700,14 +1711,11 @@ export const action: ActionFunction = getRollupReqFunctionErrorWrapper( ) export default () => { - const { appTheme, emailTheme, ogTheme } = useLoaderData<{ + const { appTheme, emailTheme, ogTheme, passportURL } = useLoaderData<{ appTheme: GetAppThemeResult emailTheme: GetEmailOTPThemeResult ogTheme: GetOgThemeResult - toasts: { - message: string - type: ToastType - }[] + passportURL: string }>() const { @@ -1856,6 +1864,7 @@ export default () => { emailTheme={emailTheme} setLoading={setLoading} errors={errors} + passportURL={passportURL} /> diff --git a/platform/email/emailTemplate.ts b/platform/email/emailTemplate.ts index 6dcc7ccecc..e6ac71b994 100644 --- a/platform/email/emailTemplate.ts +++ b/platform/email/emailTemplate.ts @@ -69,7 +69,7 @@ const EmailTemplateBase = ( content: string, subject: string ) => { - const { logoURL, address, contactURL, termsURL, privacyURL, appName } = params + const { logoURL, address, contactURL, termsURL, privacyURL } = params return { contentType: 'text/html' as EmailContentType, subject, @@ -264,14 +264,17 @@ export const EmailTemplateOTP = ( email: string, state: string, passportURL: string, - params: EmailTemplateParams + params: EmailTemplateParams, + preview: boolean = false ): EmailContent => { const content = `
Confirm Your Email Address

Please copy the code below into the email verification screen.

${passcode}

Or submit the code by clicking button below

- Verify Email Address + Verify Email Address

Please note: the code will be valid for the next 10 minutes.

If you didn't request this email, there's nothing to worry about - you can safely ignore it.