Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(themes): Add email configuration support for themes #7580

Merged
merged 14 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions config/config.example.toml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also make the same changes in the config/deployments/env_specific.toml file, maybe in a different PR?

Original file line number Diff line number Diff line change
Expand Up @@ -943,11 +943,11 @@ service = "dynamo" # Service name
file_storage_backend = "file_system" # Theme storage backend to be used

[theme.email_config]
entity_name = "Hyperswitch" # Name of the entity to be showed in emails
entity_logo_url = "https://example.com/logo.svg" # Logo URL of the entity to be used in emails
foreground_color = "#000000" # Foreground color of email text
primary_color = "#006DF9" # Primary color of email body
background_color = "#FFFFFF" # Background color of email body
entity_name = "Hyperswitch" # Display name in emails
entity_logo_url = "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png" # Logo URL for emails
foreground_color = "#111326" # Text color
primary_color = "#006DF9" # Primary color
background_color = "#FFFFFF" # Email background color

[additional_revenue_recovery_details_call]
connectors_with_additional_revenue_recovery_details_call = "stripebilling" # List of connectors which has additional revenue recovery details api-call
10 changes: 5 additions & 5 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1007,11 +1007,11 @@ service = "dynamo"
file_storage_backend = "file_system" # Theme storage backend to be used

[theme.email_config]
entity_name = "Hyperswitch" # Name of the entity to be showed in emails
entity_logo_url = "https://example.com/logo.svg" # Logo URL of the entity to be used in emails
foreground_color = "#000000" # Foreground color of email text
primary_color = "#006DF9" # Primary color of email body
background_color = "#FFFFFF" # Background color of email body
entity_name = "Hyperswitch" # Display name in emails
entity_logo_url = "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png" # Logo URL for emails
foreground_color = "#111326" # Text color
primary_color = "#006DF9" # Primary color
background_color = "#FFFFFF" # Email background color

[platform]
enabled = true
10 changes: 5 additions & 5 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -846,11 +846,11 @@ timeout = 10 # Timeout for SMTP connection in seconds
connection = "plaintext" #currently plaintext and starttls are supported

[theme.email_config]
entity_name = "Hyperswitch" # Name of the entity to be showed in emails
entity_logo_url = "https://example.com/logo.svg" # Logo URL of the entity to be used in emails
foreground_color = "#000000" # Foreground color of email text
primary_color = "#006DF9" # Primary color of email body
background_color = "#FFFFFF" # Background color of email body
entity_name = "Hyperswitch" # Display name in emails
entity_logo_url = "https://app.hyperswitch.io/email-assets/HyperswitchLogo.png" # Logo URL for emails
foreground_color = "#111326" # Text color
primary_color = "#006DF9" # Primary color
background_color = "#FFFFFF" # Email background color

[platform]
enabled = true
9 changes: 0 additions & 9 deletions crates/router/src/consts/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ pub const REDIS_RECOVERY_CODE_ATTEMPTS_TTL_IN_SECS: i64 = 10 * 60; // 10 mins
pub const REDIS_SSO_PREFIX: &str = "SSO_";
pub const REDIS_SSO_TTL: i64 = 5 * 60; // 5 minutes

/// Email subject
pub const EMAIL_SUBJECT_SIGNUP: &str = "Welcome to the Hyperswitch community!";
pub const EMAIL_SUBJECT_INVITATION: &str = "You have been invited to join Hyperswitch Community!";
pub const EMAIL_SUBJECT_MAGIC_LINK: &str = "Unlock Hyperswitch: Use Your Magic Link to Sign In";
pub const EMAIL_SUBJECT_RESET_PASSWORD: &str = "Get back to Hyperswitch - Reset Your Password Now";
pub const EMAIL_SUBJECT_NEW_PROD_INTENT: &str = "New Prod Intent";
pub const EMAIL_SUBJECT_WELCOME_TO_COMMUNITY: &str =
"Thank you for signing up on Hyperswitch Dashboard!";

pub const DEFAULT_PROFILE_NAME: &str = "default";
pub const DEFAULT_PRODUCT_TYPE: common_enums::MerchantProductType =
common_enums::MerchantProductType::Orchestration;
9 changes: 0 additions & 9 deletions crates/router/src/core/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ pub async fn signup_with_merchant_id(
recipient_email: user_from_db.get_email().try_into()?,
user_name: domain::UserName::new(user_from_db.get_name())?,
settings: state.conf.clone(),
subject: consts::user::EMAIL_SUBJECT_RESET_PASSWORD,
auth_id,
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
Expand Down Expand Up @@ -307,7 +306,6 @@ pub async fn connect_account(
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
settings: state.conf.clone(),
user_name: domain::UserName::new(user_from_db.get_name())?,
subject: consts::user::EMAIL_SUBJECT_MAGIC_LINK,
auth_id,
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
Expand Down Expand Up @@ -363,7 +361,6 @@ pub async fn connect_account(
let magic_link_email = email_types::VerifyEmail {
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
settings: state.conf.clone(),
subject: consts::user::EMAIL_SUBJECT_SIGNUP,
auth_id,
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
Expand All @@ -385,7 +382,6 @@ pub async fn connect_account(
if state.tenant.tenant_id.get_string_repr() == common_utils::consts::DEFAULT_TENANT {
let welcome_to_community_email = email_types::WelcomeToCommunity {
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
subject: consts::user::EMAIL_SUBJECT_WELCOME_TO_COMMUNITY,
};

let welcome_email_result = state
Expand Down Expand Up @@ -516,7 +512,6 @@ pub async fn forgot_password(
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
settings: state.conf.clone(),
user_name: domain::UserName::new(user_from_db.get_name())?,
subject: consts::user::EMAIL_SUBJECT_RESET_PASSWORD,
auth_id,
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
Expand Down Expand Up @@ -928,7 +923,6 @@ async fn handle_existing_user_invitation(
recipient_email: invitee_email,
user_name: domain::UserName::new(invitee_user_from_db.get_name())?,
settings: state.conf.clone(),
subject: consts::user::EMAIL_SUBJECT_INVITATION,
entity,
auth_id: auth_id.clone(),
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
Expand Down Expand Up @@ -1085,7 +1079,6 @@ async fn handle_new_user_invitation(
recipient_email: invitee_email,
user_name: domain::UserName::new(new_user.get_name())?,
settings: state.conf.clone(),
subject: consts::user::EMAIL_SUBJECT_INVITATION,
entity,
auth_id: auth_id.clone(),
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
Expand Down Expand Up @@ -1237,7 +1230,6 @@ pub async fn resend_invite(
recipient_email: invitee_email,
user_name: domain::UserName::new(user.get_name())?,
settings: state.conf.clone(),
subject: consts::user::EMAIL_SUBJECT_INVITATION,
entity: email_types::Entity {
entity_id,
entity_type,
Expand Down Expand Up @@ -1896,7 +1888,6 @@ pub async fn send_verification_mail(
let email_contents = email_types::VerifyEmail {
recipient_email: domain::UserEmail::from_pii_email(user.email)?,
settings: state.conf.clone(),
subject: consts::user::EMAIL_SUBJECT_SIGNUP,
auth_id,
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
Expand Down
Loading
Loading