diff --git a/packages/builder/src/pages/builder/portal/manage/email/index.svelte b/packages/builder/src/pages/builder/portal/manage/email/index.svelte index 56242f0fe4..a1595072af 100644 --- a/packages/builder/src/pages/builder/portal/manage/email/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/email/index.svelte @@ -68,6 +68,26 @@ } } + async function deleteSmtp() { + // Delete the SMTP config + try { + await API.deleteConfig({ + id: smtpConfig._id, + rev: smtpConfig._rev, + }) + smtpConfig = { + config: {}, + } + await admin.getChecklist() + notifications.success(`Settings cleared`) + analytics.captureEvent(Events.SMTP.SAVED) + } catch (error) { + notifications.error( + `Failed to clear email settings, reason: ${error?.message || "Unknown"}` + ) + } + } + async function fetchSmtp() { loading = true try { @@ -156,8 +176,15 @@ {/if} -
+
+
@@ -186,4 +213,8 @@ grid-gap: var(--spacing-l); align-items: center; } + .spectrum-Settings-buttonGroup { + gap: var(--spectrum-global-dimension-static-size-200); + align-items: flex-end; + } diff --git a/packages/frontend-core/src/api/configs.js b/packages/frontend-core/src/api/configs.js index 9e320f7499..8447e0d79d 100644 --- a/packages/frontend-core/src/api/configs.js +++ b/packages/frontend-core/src/api/configs.js @@ -20,6 +20,17 @@ export const buildConfigEndpoints = API => ({ }) }, + /** + * Deletes a global config + * @param id the id of the config to delete + * @param rev the revision of the config to delete + */ + deleteConfig: async ({ id, rev }) => { + return await API.delete({ + url: `/api/global/configs/${id}/${rev}`, + }) + }, + /** * Gets the config for a certain tenant. * @param tenantId the tenant ID to get the config for