| @@ -17,8 +17,9 @@ | ||
| 17 | 17 | const EMAIL_KEYS: (keyof EmailSettingsValues)[] = [ |
| 18 | 18 | "admin_email", |
| 19 | 19 | "from_email", |
| 20 | 20 | "from_name", |
| 21 | + "email_always_bcc", | |
| 21 | 22 | "email_template_booking", |
| 22 | 23 | "email_template_confirmation", |
| 23 | 24 | "email_template_cancellation", |
| 24 | 25 | "email_template_reminder", |
| @@ -26,8 +27,11 @@ | ||
| 26 | 27 | "email_template_admin_payment", |
| 27 | 28 | "email_template_admin_cancellation", |
| 28 | 29 | "email_template_trip_consent", |
| 29 | 30 | "email_template_customer_verification", |
| 31 | + "email_template_guest_verification", | |
| 32 | + "email_template_account_email_change", | |
| 33 | + "email_template_account_email_changed", | |
| 30 | 34 | "smtp_enabled", |
| 31 | 35 | "smtp_host", |
| 32 | 36 | "smtp_port", |
| 33 | 37 | "smtp_username", |
| @@ -50,8 +54,14 @@ | ||
| 50 | 54 | "email_tpl_trip_consent_subject", |
| 51 | 55 | "email_tpl_trip_consent_body", |
| 52 | 56 | "email_tpl_customer_verification_subject", |
| 53 | 57 | "email_tpl_customer_verification_body", |
| 58 | + "email_tpl_guest_verification_subject", | |
| 59 | + "email_tpl_guest_verification_body", | |
| 60 | + "email_tpl_account_email_change_subject", | |
| 61 | + "email_tpl_account_email_change_body", | |
| 62 | + "email_tpl_account_email_changed_subject", | |
| 63 | + "email_tpl_account_email_changed_body", | |
| 54 | 64 | "email_template_booking_completed", |
| 55 | 65 | "email_template_booking_expired_customer", |
| 56 | 66 | "email_template_admin_booking_expired", |
| 57 | 67 | "email_template_scheduled_payment_reminder", |
| @@ -61,9 +71,11 @@ | ||
| 61 | 71 | "email_template_enquiry_received", |
| 62 | 72 | "email_template_enquiry_admin", |
| 63 | 73 | "email_template_enquiry_response", |
| 64 | 74 | "email_template_review_request", |
| 65 | - "email_template_abandoned_booking_recovery", | |
| 75 | + "email_template_abandoned_booking_recovery_first", | |
| 76 | + "email_template_abandoned_booking_recovery_second", | |
| 77 | + "email_template_abandoned_booking_recovery_final", | |
| 66 | 78 | "email_tpl_booking_completed_subject", |
| 67 | 79 | "email_tpl_booking_completed_body", |
| 68 | 80 | "email_tpl_booking_expired_customer_subject", |
| 69 | 81 | "email_tpl_booking_expired_customer_body", |
| @@ -84,10 +96,14 @@ | ||
| 84 | 96 | "email_tpl_enquiry_response_subject", |
| 85 | 97 | "email_tpl_enquiry_response_body", |
| 86 | 98 | "email_tpl_review_request_subject", |
| 87 | 99 | "email_tpl_review_request_body", |
| 88 | - "email_tpl_abandoned_booking_recovery_subject", | |
| 89 | - "email_tpl_abandoned_booking_recovery_body", | |
| 100 | + "email_tpl_abandoned_booking_recovery_first_subject", | |
| 101 | + "email_tpl_abandoned_booking_recovery_first_body", | |
| 102 | + "email_tpl_abandoned_booking_recovery_second_subject", | |
| 103 | + "email_tpl_abandoned_booking_recovery_second_body", | |
| 104 | + "email_tpl_abandoned_booking_recovery_final_subject", | |
| 105 | + "email_tpl_abandoned_booking_recovery_final_body", | |
| 90 | 106 | ]; |
| 91 | 107 | |
| 92 | 108 | const BOOL_KEYS = new Set<keyof EmailSettingsValues>([ |
| 93 | 109 | "email_template_booking", |
| @@ -98,8 +114,11 @@ | ||
| 98 | 114 | "email_template_admin_payment", |
| 99 | 115 | "email_template_admin_cancellation", |
| 100 | 116 | "email_template_trip_consent", |
| 101 | 117 | "email_template_customer_verification", |
| 118 | + "email_template_guest_verification", | |
| 119 | + "email_template_account_email_change", | |
| 120 | + "email_template_account_email_changed", | |
| 102 | 121 | "email_template_booking_completed", |
| 103 | 122 | "email_template_booking_expired_customer", |
| 104 | 123 | "email_template_admin_booking_expired", |
| 105 | 124 | "email_template_scheduled_payment_reminder", |
| @@ -109,16 +128,19 @@ | ||
| 109 | 128 | "email_template_enquiry_received", |
| 110 | 129 | "email_template_enquiry_admin", |
| 111 | 130 | "email_template_enquiry_response", |
| 112 | 131 | "email_template_review_request", |
| 113 | - "email_template_abandoned_booking_recovery", | |
| 132 | + "email_template_abandoned_booking_recovery_first", | |
| 133 | + "email_template_abandoned_booking_recovery_second", | |
| 134 | + "email_template_abandoned_booking_recovery_final", | |
| 114 | 135 | "smtp_enabled", |
| 115 | 136 | ]); |
| 116 | 137 | |
| 117 | 138 | export const EMAIL_SETTINGS_DEFAULTS: EmailSettingsValues = { |
| 118 | - admin_email: "[email protected]", | |
| 119 | - from_email: "[email protected]", | |
| 139 | + admin_email: "[email protected]", | |
| 140 | + from_email: "[email protected]", | |
| 120 | 141 | from_name: "Yatra Travel", |
| 142 | + email_always_bcc: "", | |
| 121 | 143 | email_template_booking: true, |
| 122 | 144 | email_template_confirmation: true, |
| 123 | 145 | email_template_cancellation: true, |
| 124 | 146 | email_template_reminder: true, |
| @@ -126,8 +148,11 @@ | ||
| 126 | 148 | email_template_admin_payment: true, |
| 127 | 149 | email_template_admin_cancellation: true, |
| 128 | 150 | email_template_trip_consent: true, |
| 129 | 151 | email_template_customer_verification: true, |
| 152 | + email_template_guest_verification: true, | |
| 153 | + email_template_account_email_change: true, | |
| 154 | + email_template_account_email_changed: true, | |
| 130 | 155 | email_template_booking_completed: true, |
| 131 | 156 | email_template_booking_expired_customer: true, |
| 132 | 157 | email_template_admin_booking_expired: true, |
| 133 | 158 | email_template_scheduled_payment_reminder: true, |
| @@ -137,9 +162,11 @@ | ||
| 137 | 162 | email_template_enquiry_received: true, |
| 138 | 163 | email_template_enquiry_admin: true, |
| 139 | 164 | email_template_enquiry_response: true, |
| 140 | 165 | email_template_review_request: true, |
| 141 | - email_template_abandoned_booking_recovery: true, | |
| 166 | + email_template_abandoned_booking_recovery_first: true, | |
| 167 | + email_template_abandoned_booking_recovery_second: true, | |
| 168 | + email_template_abandoned_booking_recovery_final: true, | |
| 142 | 169 | smtp_enabled: false, |
| 143 | 170 | smtp_host: "smtp.gmail.com", |
| 144 | 171 | smtp_port: 587, |
| 145 | 172 | smtp_username: "", |
| @@ -162,8 +189,14 @@ | ||
| 162 | 189 | email_tpl_trip_consent_subject: "", |
| 163 | 190 | email_tpl_trip_consent_body: "", |
| 164 | 191 | email_tpl_customer_verification_subject: "", |
| 165 | 192 | email_tpl_customer_verification_body: "", |
| 193 | + email_tpl_guest_verification_subject: "", | |
| 194 | + email_tpl_guest_verification_body: "", | |
| 195 | + email_tpl_account_email_change_subject: "", | |
| 196 | + email_tpl_account_email_change_body: "", | |
| 197 | + email_tpl_account_email_changed_subject: "", | |
| 198 | + email_tpl_account_email_changed_body: "", | |
| 166 | 199 | email_tpl_booking_completed_subject: "", |
| 167 | 200 | email_tpl_booking_completed_body: "", |
| 168 | 201 | email_tpl_booking_expired_customer_subject: "", |
| 169 | 202 | email_tpl_booking_expired_customer_body: "", |
| @@ -184,10 +217,14 @@ | ||
| 184 | 217 | email_tpl_enquiry_response_subject: "", |
| 185 | 218 | email_tpl_enquiry_response_body: "", |
| 186 | 219 | email_tpl_review_request_subject: "", |
| 187 | 220 | email_tpl_review_request_body: "", |
| 188 | - email_tpl_abandoned_booking_recovery_subject: "", | |
| 189 | - email_tpl_abandoned_booking_recovery_body: "", | |
| 221 | + email_tpl_abandoned_booking_recovery_first_subject: "", | |
| 222 | + email_tpl_abandoned_booking_recovery_first_body: "", | |
| 223 | + email_tpl_abandoned_booking_recovery_second_subject: "", | |
| 224 | + email_tpl_abandoned_booking_recovery_second_body: "", | |
| 225 | + email_tpl_abandoned_booking_recovery_final_subject: "", | |
| 226 | + email_tpl_abandoned_booking_recovery_final_body: "", | |
| 190 | 227 | }; |
| 191 | 228 | |
| 192 | 229 | function coerceEmailValues( |
| 193 | 230 | raw: Record<string, unknown> | undefined, |
| @@ -250,9 +287,16 @@ | ||
| 250 | 287 | showToast(message, "error"); |
| 251 | 288 | throw error; |
| 252 | 289 | } |
| 253 | 290 | }, |
| 254 | - enabled: can("manage_yatra"), | |
| 291 | + // Was `manage_yatra` — that's not a registered Yatra cap, so the | |
| 292 | + // check returned false for everyone except admins-via-fallback, | |
| 293 | + // which silently broke the Email page on installs where the | |
| 294 | + // admin fallback wasn't yet wired (free, or Pro pre-Team). The | |
| 295 | + // canonical cap for the Email hub is `yatra_manage_emails`, | |
| 296 | + // registered in the Team module's CapabilityRegistry and held | |
| 297 | + // by Marketing role + Owner / Manager. | |
| 298 | + enabled: can("yatra_manage_emails"), | |
| 255 | 299 | }); |
| 256 | 300 | |
| 257 | 301 | const serverSlice = useMemo( |
| 258 | 302 | () => coerceEmailValues(settings as Record<string, unknown> | undefined), |