@blackcode_sa/metaestetics-api 1.14.63 → 1.14.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -232,6 +232,7 @@ __export(index_exports, {
232
232
  CLINIC_ANALYTICS_SUBCOLLECTION: () => CLINIC_ANALYTICS_SUBCOLLECTION,
233
233
  CalendarAdminService: () => CalendarAdminService,
234
234
  ClinicAggregationService: () => ClinicAggregationService,
235
+ ClinicWelcomeMailingService: () => ClinicWelcomeMailingService,
235
236
  DASHBOARD_ANALYTICS_SUBCOLLECTION: () => DASHBOARD_ANALYTICS_SUBCOLLECTION,
236
237
  DocumentManagerAdminService: () => DocumentManagerAdminService,
237
238
  ExistingPractitionerInviteMailingService: () => ExistingPractitionerInviteMailingService,
@@ -2054,195 +2055,139 @@ var patientAppointmentConfirmedTemplate = `
2054
2055
  <meta charset="UTF-8">
2055
2056
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
2056
2057
  <title>Appointment Confirmed</title>
2057
- <style>
2058
- body {
2059
- margin: 0;
2060
- padding: 0;
2061
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
2062
- background: linear-gradient(135deg, #a48a76 0%, #67574A 100%);
2063
- min-height: 100vh;
2064
- }
2065
- .email-container {
2066
- max-width: 600px;
2067
- margin: 0 auto;
2068
- background: #ffffff;
2069
- border-radius: 20px;
2070
- overflow: hidden;
2071
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
2072
- margin-top: 40px;
2073
- margin-bottom: 40px;
2074
- }
2075
- .header {
2076
- background: linear-gradient(135deg, #a48a76 0%, #67574A 100%);
2077
- padding: 40px 30px;
2078
- text-align: center;
2079
- color: white;
2080
- }
2081
- .header h1 {
2082
- margin: 0;
2083
- font-size: 28px;
2084
- font-weight: 300;
2085
- letter-spacing: 1px;
2086
- }
2087
- .header .subtitle {
2088
- margin: 10px 0 0 0;
2089
- font-size: 16px;
2090
- opacity: 0.9;
2091
- font-weight: 300;
2092
- }
2093
- .content {
2094
- padding: 40px 30px;
2095
- }
2096
- .greeting {
2097
- font-size: 18px;
2098
- color: #333;
2099
- margin-bottom: 25px;
2100
- font-weight: 400;
2101
- }
2102
- .appointment-card {
2103
- background: linear-gradient(135deg, #f8f6f5 0%, #f5f3f2 100%);
2104
- border-radius: 15px;
2105
- padding: 30px;
2106
- margin: 25px 0;
2107
- border-left: 5px solid #a48a76;
2108
- }
2109
- .appointment-title {
2110
- font-size: 20px;
2111
- color: #a48a76;
2112
- margin-bottom: 20px;
2113
- font-weight: 600;
2114
- }
2115
- .appointment-details {
2116
- display: grid;
2117
- gap: 15px;
2118
- }
2119
- .detail-row {
2120
- display: flex;
2121
- align-items: center;
2122
- padding: 8px 0;
2123
- }
2124
- .detail-label {
2125
- font-weight: 600;
2126
- color: #555;
2127
- min-width: 120px;
2128
- font-size: 14px;
2129
- }
2130
- .detail-value {
2131
- color: #333;
2132
- font-size: 16px;
2133
- font-weight: 500;
2134
- }
2135
- .procedure-name {
2136
- color: #67574A;
2137
- font-weight: 600;
2138
- }
2139
- .clinic-name {
2140
- color: #a48a76;
2141
- font-weight: 600;
2142
- }
2143
- .success-icon {
2144
- text-align: center;
2145
- margin: 20px 0;
2146
- font-size: 48px;
2147
- }
2148
- .footer {
2149
- background: #f8f9fa;
2150
- padding: 25px 30px;
2151
- text-align: center;
2152
- color: #666;
2153
- font-size: 14px;
2154
- border-top: 1px solid #eee;
2155
- }
2156
- .logo {
2157
- font-size: 24px;
2158
- font-weight: 700;
2159
- color: white;
2160
- margin-bottom: 5px;
2161
- }
2162
- .divider {
2163
- height: 2px;
2164
- background: linear-gradient(90deg, #a48a76, #67574A);
2165
- margin: 25px 0;
2166
- border-radius: 1px;
2167
- }
2168
- .thank-you {
2169
- background: linear-gradient(135deg, #f0ede8 0%, #ebe6e0 100%);
2170
- border-radius: 15px;
2171
- padding: 25px;
2172
- margin: 25px 0;
2173
- text-align: center;
2174
- border-left: 5px solid #4CAF50;
2175
- }
2176
- </style>
2058
+ <!--[if mso]>
2059
+ <noscript>
2060
+ <xml>
2061
+ <o:OfficeDocumentSettings>
2062
+ <o:PixelsPerInch>96</o:PixelsPerInch>
2063
+ </o:OfficeDocumentSettings>
2064
+ </xml>
2065
+ </noscript>
2066
+ <![endif]-->
2177
2067
  </head>
2178
- <body>
2179
- <div class="email-container">
2180
- <div class="header">
2181
- <div class="logo">MetaEstetics</div>
2182
- <h1>Appointment Confirmed</h1>
2183
- <div class="subtitle">Your Beauty Journey Awaits</div>
2184
- </div>
2185
-
2186
- <div class="content">
2187
- <div class="success-icon">\u2728</div>
2188
-
2189
- <div class="greeting">
2190
- Dear <strong>{{patientName}}</strong>,
2191
- </div>
2192
-
2193
- <p style="color: #555; font-size: 16px; line-height: 1.6; margin-bottom: 25px;">
2194
- We're delighted to confirm your appointment! Your journey to enhanced beauty and confidence is just around the corner.
2195
- </p>
2196
-
2197
- <div class="appointment-card">
2198
- <div class="appointment-title">\u{1F4C5} Your Appointment Details</div>
2199
- <div class="appointment-details">
2200
- <div class="detail-row">
2201
- <div class="detail-label">Procedure:</div>
2202
- <div class="detail-value procedure-name">{{procedureName}}</div>
2203
- </div>
2204
- <div class="detail-row">
2205
- <div class="detail-label">Date:</div>
2206
- <div class="detail-value">{{appointmentDate}}</div>
2207
- </div>
2208
- <div class="detail-row">
2209
- <div class="detail-label">Time:</div>
2210
- <div class="detail-value">{{appointmentTime}}</div>
2211
- </div>
2212
- <div class="detail-row">
2213
- <div class="detail-label">Practitioner:</div>
2214
- <div class="detail-value">{{practitionerName}}</div>
2215
- </div>
2216
- <div class="detail-row">
2217
- <div class="detail-label">Location:</div>
2218
- <div class="detail-value clinic-name">{{clinicName}}</div>
2219
- </div>
2220
- </div>
2221
- </div>
2222
-
2223
- <div class="divider"></div>
2224
-
2225
- <div class="thank-you">
2226
- <h3 style="margin: 0 0 10px 0; color: #4caf50; font-weight: 600;">Thank You for Choosing MetaEstetics!</h3>
2227
- <p style="margin: 0; color: #555; font-size: 14px;">
2228
- We look forward to providing you with exceptional care and outstanding results.
2229
- </p>
2230
- </div>
2231
-
2232
- <p style="color: #555; font-size: 14px; line-height: 1.6; margin-top: 25px;">
2233
- <strong>Important:</strong> Please arrive 15 minutes early for your appointment. If you need to reschedule or have any questions, please contact us as soon as possible.
2234
- </p>
2235
- </div>
2236
-
2237
- <div class="footer">
2238
- <p style="margin: 0 0 10px 0;">
2239
- <strong>MetaEstetics</strong> - Premium Aesthetic Services
2240
- </p>
2241
- <p style="margin: 0; font-size: 12px; color: #999;">
2242
- This is an automated message. Please do not reply to this email.
2243
- </p>
2244
- </div>
2245
- </div>
2068
+ <body style="margin: 0; padding: 0; background-color: #f8f6f5; font-family: Georgia, 'Times New Roman', serif;">
2069
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color: #f8f6f5;">
2070
+ <tr>
2071
+ <td align="center" style="padding: 40px 20px;">
2072
+ <table role="presentation" width="600" cellspacing="0" cellpadding="0" border="0" style="max-width: 600px; background-color: #ffffff; border-radius: 2px; box-shadow: 0 1px 3px rgba(103, 87, 74, 0.08);">
2073
+
2074
+ <!-- Header -->
2075
+ <tr>
2076
+ <td style="padding: 48px 48px 32px 48px; border-bottom: 1px solid #f0ebe6;">
2077
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
2078
+ <tr>
2079
+ <td>
2080
+ <h1 style="margin: 0; font-size: 24px; font-weight: 400; color: #67574A; letter-spacing: 2px; text-transform: uppercase; font-family: Georgia, 'Times New Roman', serif;">MetaEstetics</h1>
2081
+ </td>
2082
+ </tr>
2083
+ </table>
2084
+ </td>
2085
+ </tr>
2086
+
2087
+ <!-- Confirmed Banner -->
2088
+ <tr>
2089
+ <td style="padding: 0;">
2090
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color: #00BB38;">
2091
+ <tr>
2092
+ <td style="padding: 20px 48px;">
2093
+ <p style="margin: 0; font-size: 13px; font-weight: 600; color: #ffffff; letter-spacing: 1.5px; text-transform: uppercase; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Appointment Confirmed</p>
2094
+ </td>
2095
+ </tr>
2096
+ </table>
2097
+ </td>
2098
+ </tr>
2099
+
2100
+ <!-- Main Content -->
2101
+ <tr>
2102
+ <td style="padding: 40px 48px;">
2103
+
2104
+ <!-- Greeting -->
2105
+ <p style="margin: 0 0 24px 0; font-size: 17px; color: #333333; line-height: 1.6; font-family: Georgia, 'Times New Roman', serif;">
2106
+ Dear {{patientName}},
2107
+ </p>
2108
+
2109
+ <p style="margin: 0 0 32px 0; font-size: 16px; color: #555555; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2110
+ Your appointment has been confirmed. We look forward to seeing you.
2111
+ </p>
2112
+
2113
+ <!-- Appointment Details Card -->
2114
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 32px; background-color: #faf9f7; border-left: 3px solid #00BB38;">
2115
+ <tr>
2116
+ <td style="padding: 24px;">
2117
+ <p style="margin: 0 0 4px 0; font-size: 11px; font-weight: 600; color: #868686; letter-spacing: 1px; text-transform: uppercase; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Procedure</p>
2118
+ <p style="margin: 0 0 20px 0; font-size: 18px; color: #67574A; font-weight: 500; font-family: Georgia, 'Times New Roman', serif;">{{procedureName}}</p>
2119
+
2120
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
2121
+ <tr>
2122
+ <td style="padding-bottom: 16px;">
2123
+ <p style="margin: 0 0 2px 0; font-size: 11px; color: #868686; text-transform: uppercase; letter-spacing: 0.5px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Date & Time</p>
2124
+ <p style="margin: 0; font-size: 15px; color: #333333; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">{{appointmentDate}}</p>
2125
+ <p style="margin: 4px 0 0 0; font-size: 14px; color: #67574A; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">{{appointmentTime}}</p>
2126
+ </td>
2127
+ </tr>
2128
+ <tr>
2129
+ <td style="padding-bottom: 16px;">
2130
+ <p style="margin: 0 0 2px 0; font-size: 11px; color: #868686; text-transform: uppercase; letter-spacing: 0.5px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Practitioner</p>
2131
+ <p style="margin: 0; font-size: 15px; color: #333333; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">{{practitionerName}}</p>
2132
+ </td>
2133
+ </tr>
2134
+ <tr>
2135
+ <td>
2136
+ <p style="margin: 0 0 2px 0; font-size: 11px; color: #868686; text-transform: uppercase; letter-spacing: 0.5px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Location</p>
2137
+ <p style="margin: 0; font-size: 15px; color: #333333; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">{{clinicName}}</p>
2138
+ </td>
2139
+ </tr>
2140
+ </table>
2141
+ </td>
2142
+ </tr>
2143
+ </table>
2144
+
2145
+ <!-- Divider -->
2146
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 32px;">
2147
+ <tr>
2148
+ <td style="height: 1px; background-color: #e8e4df;"></td>
2149
+ </tr>
2150
+ </table>
2151
+
2152
+ <!-- Important Notice -->
2153
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 24px;">
2154
+ <tr>
2155
+ <td style="padding: 20px 24px; background-color: #faf9f7; border-left: 3px solid #a48a76;">
2156
+ <p style="margin: 0 0 8px 0; font-size: 13px; font-weight: 600; color: #67574A; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Before Your Visit</p>
2157
+ <p style="margin: 0; font-size: 14px; color: #555555; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2158
+ Please arrive 15 minutes early. If you need to reschedule or cancel, contact us through the MetaEstetics app.
2159
+ </p>
2160
+ </td>
2161
+ </tr>
2162
+ </table>
2163
+
2164
+ <!-- Thank You -->
2165
+ <p style="margin: 0; font-size: 14px; color: #868686; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2166
+ Thank you for choosing {{clinicName}}. We look forward to providing you with exceptional care.
2167
+ </p>
2168
+
2169
+ </td>
2170
+ </tr>
2171
+
2172
+ <!-- Footer -->
2173
+ <tr>
2174
+ <td style="padding: 32px 48px; background-color: #faf9f7; border-top: 1px solid #f0ebe6;">
2175
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
2176
+ <tr>
2177
+ <td>
2178
+ <p style="margin: 0 0 8px 0; font-size: 14px; font-weight: 500; color: #67574A; font-family: Georgia, 'Times New Roman', serif;">{{clinicName}}</p>
2179
+ <p style="margin: 0 0 16px 0; font-size: 13px; color: #868686; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Premium Aesthetic Services</p>
2180
+ <p style="margin: 0; font-size: 11px; color: #aaaaaa; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">This is an automated message from MetaEstetics. Please do not reply directly to this email.</p>
2181
+ </td>
2182
+ </tr>
2183
+ </table>
2184
+ </td>
2185
+ </tr>
2186
+
2187
+ </table>
2188
+ </td>
2189
+ </tr>
2190
+ </table>
2246
2191
  </body>
2247
2192
  </html>
2248
2193
  `;
@@ -2575,27 +2520,20 @@ var appointmentCancelledTemplate = `
2575
2520
  </table>
2576
2521
 
2577
2522
  <!-- Rebook Section -->
2578
- <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 32px; background-color: #f0faf4; border-left: 3px solid #00BB38;">
2523
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 24px; background-color: #f0faf4; border-left: 3px solid #00BB38;">
2579
2524
  <tr>
2580
- <td style="padding: 28px;">
2581
- <p style="margin: 0 0 12px 0; font-size: 15px; font-weight: 600; color: #00BB38; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Book a New Appointment</p>
2582
- <p style="margin: 0 0 20px 0; font-size: 14px; color: #555555; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2583
- We'd love to see you. Open the MetaEstetics app to browse available times and book a new appointment.
2525
+ <td style="padding: 24px;">
2526
+ <p style="margin: 0 0 8px 0; font-size: 14px; font-weight: 600; color: #00BB38; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Book a New Appointment</p>
2527
+ <p style="margin: 0; font-size: 14px; color: #555555; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2528
+ We'd love to see you again. Open the MetaEstetics app to browse available times and book a new appointment.
2584
2529
  </p>
2585
- <table role="presentation" cellspacing="0" cellpadding="0" border="0">
2586
- <tr>
2587
- <td style="background-color: #67574A; border-radius: 2px;">
2588
- <a href="#" style="display: inline-block; padding: 14px 32px; font-size: 13px; font-weight: 600; color: #ffffff; text-decoration: none; letter-spacing: 0.5px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Book New Appointment</a>
2589
- </td>
2590
- </tr>
2591
- </table>
2592
2530
  </td>
2593
2531
  </tr>
2594
2532
  </table>
2595
2533
 
2596
2534
  <!-- Support Info -->
2597
2535
  <p style="margin: 0; font-size: 13px; color: #868686; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2598
- If you have any questions about this cancellation, please contact {{clinicName}} directly through the app.
2536
+ If you have any questions about this cancellation, please contact {{clinicName}} through the MetaEstetics app.
2599
2537
  </p>
2600
2538
 
2601
2539
  </td>
@@ -2735,31 +2673,18 @@ var appointmentRescheduledProposalTemplate = `
2735
2673
  <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 32px; background-color: #faf9f7;">
2736
2674
  <tr>
2737
2675
  <td style="padding: 28px;">
2738
- <p style="margin: 0 0 16px 0; font-size: 15px; font-weight: 600; color: #67574A; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">How to Respond</p>
2739
- <p style="margin: 0 0 16px 0; font-size: 14px; color: #555555; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2676
+ <p style="margin: 0 0 8px 0; font-size: 14px; font-weight: 600; color: #67574A; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">How to Respond</p>
2677
+ <p style="margin: 0; font-size: 14px; color: #555555; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2740
2678
  Open the MetaEstetics app to accept or decline this reschedule request. Your appointment will remain pending until you respond.
2741
2679
  </p>
2742
- <table role="presentation" cellspacing="0" cellpadding="0" border="0">
2743
- <tr>
2744
- <td style="background-color: #67574A; border-radius: 2px;">
2745
- <a href="#" style="display: inline-block; padding: 14px 32px; font-size: 13px; font-weight: 600; color: #ffffff; text-decoration: none; letter-spacing: 0.5px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">Open App</a>
2746
- </td>
2747
- </tr>
2748
- </table>
2749
2680
  </td>
2750
2681
  </tr>
2751
2682
  </table>
2752
2683
 
2753
- <!-- Pending Notice -->
2754
- <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
2755
- <tr>
2756
- <td style="padding: 16px 20px; background-color: #fff8f0; border: 1px solid #f0e6d9; border-radius: 2px;">
2757
- <p style="margin: 0; font-size: 13px; color: #a48a76; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2758
- <strong>Status:</strong> Pending your response. Please respond as soon as possible so we can confirm your appointment.
2759
- </p>
2760
- </td>
2761
- </tr>
2762
- </table>
2684
+ <!-- Response Notice -->
2685
+ <p style="margin: 0; font-size: 13px; color: #868686; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
2686
+ Please respond at your earliest convenience so we can finalize your appointment. If you have questions, contact {{clinicName}} through the app.
2687
+ </p>
2763
2688
 
2764
2689
  </td>
2765
2690
  </tr>
@@ -3207,6 +3132,11 @@ var AppointmentMailingService = class extends BaseMailingService {
3207
3132
  };
3208
3133
 
3209
3134
  // src/admin/aggregation/appointment/appointment.aggregation.service.ts
3135
+ function sanitizeCancellationReason(reason) {
3136
+ if (!reason) return void 0;
3137
+ const isLikelyId = !reason.includes(" ") && /^[a-zA-Z0-9_-]+$/.test(reason) && reason.length > 15;
3138
+ return isLikelyId ? void 0 : reason;
3139
+ }
3210
3140
  var AppointmentAggregationService = class {
3211
3141
  /**
3212
3142
  * Constructor for AppointmentAggregationService.
@@ -3488,7 +3418,7 @@ var AppointmentAggregationService = class {
3488
3418
  appointment: after,
3489
3419
  recipientProfile: after.patientInfo,
3490
3420
  recipientRole: "patient",
3491
- cancellationReason: after.cancellationReason
3421
+ cancellationReason: sanitizeCancellationReason(after.cancellationReason)
3492
3422
  };
3493
3423
  await this.appointmentMailingService.sendAppointmentCancelledEmail(
3494
3424
  patientCancellationData
@@ -3502,7 +3432,7 @@ var AppointmentAggregationService = class {
3502
3432
  appointment: after,
3503
3433
  recipientProfile: after.practitionerInfo,
3504
3434
  recipientRole: "practitioner",
3505
- cancellationReason: after.cancellationReason
3435
+ cancellationReason: sanitizeCancellationReason(after.cancellationReason)
3506
3436
  };
3507
3437
  await this.appointmentMailingService.sendAppointmentCancelledEmail(
3508
3438
  practitionerCancellationData
@@ -14164,6 +14094,433 @@ var PatientInviteMailingService = class extends BaseMailingService {
14164
14094
  }
14165
14095
  };
14166
14096
 
14097
+ // src/admin/mailing/clinicWelcome/templates/welcome.template.ts
14098
+ var clinicWelcomeTemplate = `
14099
+ <!DOCTYPE html>
14100
+ <html>
14101
+ <head>
14102
+ <meta charset="UTF-8">
14103
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
14104
+ <title>Welcome to MetaEsthetics</title>
14105
+ <style>
14106
+ body {
14107
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
14108
+ line-height: 1.6;
14109
+ color: #333;
14110
+ margin: 0;
14111
+ padding: 0;
14112
+ background-color: #f5f5f5;
14113
+ }
14114
+ .container {
14115
+ max-width: 600px;
14116
+ margin: 0 auto;
14117
+ padding: 20px;
14118
+ }
14119
+ .header {
14120
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
14121
+ padding: 40px 20px;
14122
+ text-align: center;
14123
+ border-radius: 8px 8px 0 0;
14124
+ }
14125
+ .header h1 {
14126
+ color: white;
14127
+ margin: 0;
14128
+ font-size: 28px;
14129
+ font-weight: 600;
14130
+ }
14131
+ .header p {
14132
+ color: rgba(255, 255, 255, 0.9);
14133
+ margin: 10px 0 0 0;
14134
+ font-size: 16px;
14135
+ }
14136
+ .content {
14137
+ padding: 40px 30px;
14138
+ background-color: #ffffff;
14139
+ }
14140
+ .greeting {
14141
+ font-size: 18px;
14142
+ color: #333;
14143
+ margin-bottom: 20px;
14144
+ }
14145
+ .message {
14146
+ font-size: 16px;
14147
+ color: #555;
14148
+ margin-bottom: 25px;
14149
+ }
14150
+ .highlight-box {
14151
+ background: linear-gradient(135deg, #f6f9fc 0%, #eef2f7 100%);
14152
+ border-left: 4px solid #667eea;
14153
+ padding: 20px;
14154
+ margin: 25px 0;
14155
+ border-radius: 0 8px 8px 0;
14156
+ }
14157
+ .highlight-box h3 {
14158
+ margin: 0 0 10px 0;
14159
+ color: #333;
14160
+ font-size: 16px;
14161
+ }
14162
+ .highlight-box p {
14163
+ margin: 0;
14164
+ color: #555;
14165
+ }
14166
+ .next-steps {
14167
+ margin: 30px 0;
14168
+ }
14169
+ .next-steps h3 {
14170
+ color: #333;
14171
+ font-size: 18px;
14172
+ margin-bottom: 15px;
14173
+ }
14174
+ .step {
14175
+ display: flex;
14176
+ align-items: flex-start;
14177
+ margin-bottom: 15px;
14178
+ }
14179
+ .step-number {
14180
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
14181
+ color: white;
14182
+ width: 28px;
14183
+ height: 28px;
14184
+ border-radius: 50%;
14185
+ display: flex;
14186
+ align-items: center;
14187
+ justify-content: center;
14188
+ font-weight: 600;
14189
+ font-size: 14px;
14190
+ margin-right: 12px;
14191
+ flex-shrink: 0;
14192
+ }
14193
+ .step-content {
14194
+ flex: 1;
14195
+ padding-top: 3px;
14196
+ }
14197
+ .step-title {
14198
+ font-weight: 600;
14199
+ color: #333;
14200
+ margin-bottom: 3px;
14201
+ }
14202
+ .step-description {
14203
+ color: #666;
14204
+ font-size: 14px;
14205
+ }
14206
+ .button-container {
14207
+ text-align: center;
14208
+ margin: 35px 0;
14209
+ }
14210
+ .button {
14211
+ display: inline-block;
14212
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
14213
+ color: white;
14214
+ text-decoration: none;
14215
+ padding: 14px 32px;
14216
+ border-radius: 6px;
14217
+ font-weight: 600;
14218
+ font-size: 16px;
14219
+ transition: transform 0.2s;
14220
+ }
14221
+ .button:hover {
14222
+ transform: translateY(-2px);
14223
+ }
14224
+ .support-box {
14225
+ background-color: #f8f9fa;
14226
+ padding: 20px;
14227
+ border-radius: 8px;
14228
+ margin-top: 30px;
14229
+ text-align: center;
14230
+ }
14231
+ .support-box p {
14232
+ margin: 0 0 10px 0;
14233
+ color: #555;
14234
+ }
14235
+ .support-box a {
14236
+ color: #667eea;
14237
+ text-decoration: none;
14238
+ font-weight: 500;
14239
+ }
14240
+ .footer {
14241
+ padding: 30px;
14242
+ text-align: center;
14243
+ background-color: #f8f9fa;
14244
+ border-radius: 0 0 8px 8px;
14245
+ }
14246
+ .footer p {
14247
+ margin: 5px 0;
14248
+ font-size: 13px;
14249
+ color: #888;
14250
+ }
14251
+ .footer a {
14252
+ color: #667eea;
14253
+ text-decoration: none;
14254
+ }
14255
+ .social-links {
14256
+ margin: 15px 0;
14257
+ }
14258
+ .social-links a {
14259
+ display: inline-block;
14260
+ margin: 0 8px;
14261
+ color: #888;
14262
+ text-decoration: none;
14263
+ }
14264
+ </style>
14265
+ </head>
14266
+ <body>
14267
+ <div class="container">
14268
+ <div class="header">
14269
+ <h1>Welcome to MetaEsthetics!</h1>
14270
+ <p>Your clinic registration is complete</p>
14271
+ </div>
14272
+ <div class="content">
14273
+ <p class="greeting">Hello {{adminName}},</p>
14274
+
14275
+ <p class="message">
14276
+ Thank you for registering <strong>{{clinicGroupName}}</strong> with MetaEsthetics.
14277
+ Your account has been successfully created and you're now ready to start managing
14278
+ your aesthetic practice with our comprehensive platform.
14279
+ </p>
14280
+
14281
+ <div class="highlight-box">
14282
+ <h3>Account Details</h3>
14283
+ <p><strong>Clinic Group:</strong> {{clinicGroupName}}</p>
14284
+ <p><strong>Admin Email:</strong> {{adminEmail}}</p>
14285
+ <p><strong>Registration Date:</strong> {{registrationDate}}</p>
14286
+ </div>
14287
+
14288
+ <div class="next-steps">
14289
+ <h3>Get Started with MetaEsthetics</h3>
14290
+
14291
+ <div class="step">
14292
+ <div class="step-number">1</div>
14293
+ <div class="step-content">
14294
+ <div class="step-title">Complete Your Profile</div>
14295
+ <div class="step-description">Add your clinic details, working hours, and upload photos to attract patients.</div>
14296
+ </div>
14297
+ </div>
14298
+
14299
+ <div class="step">
14300
+ <div class="step-number">2</div>
14301
+ <div class="step-content">
14302
+ <div class="step-title">Add Your Team</div>
14303
+ <div class="step-description">Invite practitioners and staff members to join your clinic.</div>
14304
+ </div>
14305
+ </div>
14306
+
14307
+ <div class="step">
14308
+ <div class="step-number">3</div>
14309
+ <div class="step-content">
14310
+ <div class="step-title">Set Up Services</div>
14311
+ <div class="step-description">Configure your procedures, pricing, and availability for bookings.</div>
14312
+ </div>
14313
+ </div>
14314
+
14315
+ <div class="step">
14316
+ <div class="step-number">4</div>
14317
+ <div class="step-content">
14318
+ <div class="step-title">Start Accepting Patients</div>
14319
+ <div class="step-description">Begin managing appointments and growing your practice.</div>
14320
+ </div>
14321
+ </div>
14322
+ </div>
14323
+
14324
+ <div class="button-container">
14325
+ <a href="{{dashboardUrl}}" class="button">Go to Dashboard</a>
14326
+ </div>
14327
+
14328
+ <div class="support-box">
14329
+ <p>Need help getting started?</p>
14330
+ <p>Contact our support team at <a href="mailto:{{supportEmail}}">{{supportEmail}}</a></p>
14331
+ </div>
14332
+ </div>
14333
+ <div class="footer">
14334
+ <p>This is an automated message from MetaEsthetics.</p>
14335
+ <p>&copy; {{currentYear}} MetaEsthetics. All rights reserved.</p>
14336
+ <div class="social-links">
14337
+ <a href="https://metaesthetics.net">Website</a> |
14338
+ <a href="https://metaesthetics.net/privacy">Privacy Policy</a> |
14339
+ <a href="https://metaesthetics.net/terms">Terms of Service</a>
14340
+ </div>
14341
+ </div>
14342
+ </div>
14343
+ </body>
14344
+ </html>
14345
+ `;
14346
+
14347
+ // src/admin/mailing/clinicWelcome/clinicWelcome.mailing.ts
14348
+ var ClinicWelcomeMailingService = class extends BaseMailingService {
14349
+ /**
14350
+ * Constructor for ClinicWelcomeMailingService
14351
+ * @param firestore - Firestore instance provided by the caller
14352
+ * @param mailgunClient - Mailgun client instance (mailgun.js v10+) provided by the caller
14353
+ */
14354
+ constructor(firestore19, mailgunClient) {
14355
+ super(firestore19, mailgunClient);
14356
+ this.DEFAULT_DASHBOARD_URL = "https://clinic.metaesthetics.net/dashboard";
14357
+ this.DEFAULT_SUPPORT_EMAIL = "support@metaesthetics.net";
14358
+ this.DEFAULT_SUBJECT = "Welcome to MetaEsthetics - Your Clinic Registration is Complete";
14359
+ this.DEFAULT_MAILGUN_DOMAIN = "mg.metaesthetics.net";
14360
+ }
14361
+ /**
14362
+ * Sends a clinic welcome email
14363
+ * @param data - The clinic welcome email data
14364
+ * @returns Promise resolved when email is sent
14365
+ */
14366
+ async sendWelcomeEmail(data) {
14367
+ var _a, _b, _c, _d, _e, _f, _g;
14368
+ try {
14369
+ Logger.info(
14370
+ "[ClinicWelcomeMailingService] Sending welcome email to",
14371
+ data.admin.email
14372
+ );
14373
+ const registrationDate = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
14374
+ weekday: "long",
14375
+ year: "numeric",
14376
+ month: "long",
14377
+ day: "numeric"
14378
+ });
14379
+ const dashboardUrl = ((_a = data.options) == null ? void 0 : _a.dashboardUrl) || this.DEFAULT_DASHBOARD_URL;
14380
+ const supportEmail = ((_b = data.options) == null ? void 0 : _b.supportEmail) || this.DEFAULT_SUPPORT_EMAIL;
14381
+ const subject = ((_c = data.options) == null ? void 0 : _c.customSubject) || this.DEFAULT_SUBJECT;
14382
+ const fromAddress = ((_d = data.options) == null ? void 0 : _d.fromAddress) || `MetaEsthetics <no-reply@${((_e = data.options) == null ? void 0 : _e.mailgunDomain) || this.DEFAULT_MAILGUN_DOMAIN}>`;
14383
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear().toString();
14384
+ const templateVariables = {
14385
+ adminName: data.admin.name,
14386
+ adminEmail: data.admin.email,
14387
+ clinicGroupName: data.clinicGroup.name,
14388
+ registrationDate,
14389
+ dashboardUrl,
14390
+ supportEmail,
14391
+ currentYear
14392
+ };
14393
+ Logger.info("[ClinicWelcomeMailingService] Template variables:", {
14394
+ adminName: templateVariables.adminName,
14395
+ adminEmail: templateVariables.adminEmail,
14396
+ clinicGroupName: templateVariables.clinicGroupName,
14397
+ dashboardUrl: templateVariables.dashboardUrl
14398
+ });
14399
+ const html = this.renderTemplate(clinicWelcomeTemplate, templateVariables);
14400
+ const mailgunSendData = {
14401
+ to: data.admin.email,
14402
+ from: fromAddress,
14403
+ subject,
14404
+ html
14405
+ };
14406
+ const domainToSendFrom = ((_f = data.options) == null ? void 0 : _f.mailgunDomain) || this.DEFAULT_MAILGUN_DOMAIN;
14407
+ Logger.info("[ClinicWelcomeMailingService] Sending email with data:", {
14408
+ domain: domainToSendFrom,
14409
+ to: mailgunSendData.to,
14410
+ from: mailgunSendData.from,
14411
+ subject: mailgunSendData.subject,
14412
+ hasHtml: !!mailgunSendData.html
14413
+ });
14414
+ const result = await this.sendEmail(domainToSendFrom, mailgunSendData);
14415
+ await this.logEmailAttempt(
14416
+ {
14417
+ to: data.admin.email,
14418
+ subject,
14419
+ templateName: "clinic_welcome"
14420
+ },
14421
+ true
14422
+ );
14423
+ return result;
14424
+ } catch (error) {
14425
+ Logger.error(
14426
+ "[ClinicWelcomeMailingService] Error sending welcome email:",
14427
+ {
14428
+ errorMessage: error.message,
14429
+ errorDetails: error.details,
14430
+ errorStatus: error.status,
14431
+ stack: error.stack
14432
+ }
14433
+ );
14434
+ await this.logEmailAttempt(
14435
+ {
14436
+ to: data.admin.email,
14437
+ subject: ((_g = data.options) == null ? void 0 : _g.customSubject) || this.DEFAULT_SUBJECT,
14438
+ templateName: "clinic_welcome"
14439
+ },
14440
+ false,
14441
+ error
14442
+ );
14443
+ throw error;
14444
+ }
14445
+ }
14446
+ /**
14447
+ * Handles the clinic group creation event from Cloud Functions.
14448
+ * Fetches necessary data and sends the welcome email to the admin.
14449
+ * @param clinicGroupData - The clinic group data including id
14450
+ * @param mailgunConfig - Mailgun configuration (from, domain)
14451
+ * @returns Promise resolved when the email is sent
14452
+ */
14453
+ async handleClinicGroupCreationEvent(clinicGroupData, mailgunConfig) {
14454
+ try {
14455
+ Logger.info(
14456
+ "[ClinicWelcomeMailingService] Handling clinic group creation event for:",
14457
+ clinicGroupData.id
14458
+ );
14459
+ if (!clinicGroupData || !clinicGroupData.id) {
14460
+ throw new Error(
14461
+ `Invalid clinic group data: Missing required properties.`
14462
+ );
14463
+ }
14464
+ if (!clinicGroupData.contactPerson) {
14465
+ throw new Error(
14466
+ `Clinic group ${clinicGroupData.id} is missing contactPerson`
14467
+ );
14468
+ }
14469
+ if (!clinicGroupData.contactPerson.email) {
14470
+ throw new Error(
14471
+ `Clinic group ${clinicGroupData.id} is missing admin email`
14472
+ );
14473
+ }
14474
+ const adminName = `${clinicGroupData.contactPerson.firstName || ""} ${clinicGroupData.contactPerson.lastName || ""}`.trim() || "Clinic Admin";
14475
+ const adminEmail = clinicGroupData.contactPerson.email;
14476
+ Logger.info(
14477
+ `[ClinicWelcomeMailingService] Sending welcome email to admin: ${adminName} (${adminEmail})`
14478
+ );
14479
+ if (!mailgunConfig.fromAddress) {
14480
+ Logger.warn(
14481
+ "[ClinicWelcomeMailingService] No fromAddress provided, using default"
14482
+ );
14483
+ mailgunConfig.fromAddress = `MetaEsthetics <no-reply@${this.DEFAULT_MAILGUN_DOMAIN}>`;
14484
+ }
14485
+ const emailData = {
14486
+ admin: {
14487
+ name: adminName,
14488
+ email: adminEmail
14489
+ },
14490
+ clinicGroup: {
14491
+ id: clinicGroupData.id,
14492
+ name: clinicGroupData.name || "Your Clinic"
14493
+ },
14494
+ options: {
14495
+ fromAddress: mailgunConfig.fromAddress,
14496
+ mailgunDomain: mailgunConfig.domain,
14497
+ dashboardUrl: mailgunConfig.dashboardUrl,
14498
+ supportEmail: mailgunConfig.supportEmail
14499
+ }
14500
+ };
14501
+ Logger.info(
14502
+ "[ClinicWelcomeMailingService] Email data prepared, sending welcome email"
14503
+ );
14504
+ await this.sendWelcomeEmail(emailData);
14505
+ Logger.info(
14506
+ "[ClinicWelcomeMailingService] Welcome email sent successfully"
14507
+ );
14508
+ } catch (error) {
14509
+ Logger.error(
14510
+ "[ClinicWelcomeMailingService] Error handling clinic group creation event:",
14511
+ {
14512
+ errorMessage: error.message,
14513
+ errorDetails: error.details,
14514
+ errorStatus: error.status,
14515
+ stack: error.stack,
14516
+ clinicGroupId: clinicGroupData == null ? void 0 : clinicGroupData.id
14517
+ }
14518
+ );
14519
+ throw error;
14520
+ }
14521
+ }
14522
+ };
14523
+
14167
14524
  // src/admin/users/user-profile.admin.ts
14168
14525
  var admin18 = __toESM(require("firebase-admin"));
14169
14526
  var UserProfileAdminService = class {
@@ -14466,6 +14823,7 @@ TimestampUtils.enableServerMode();
14466
14823
  CLINIC_ANALYTICS_SUBCOLLECTION,
14467
14824
  CalendarAdminService,
14468
14825
  ClinicAggregationService,
14826
+ ClinicWelcomeMailingService,
14469
14827
  DASHBOARD_ANALYTICS_SUBCOLLECTION,
14470
14828
  DocumentManagerAdminService,
14471
14829
  ExistingPractitionerInviteMailingService,