@blackcode_sa/metaestetics-api 1.14.63 → 1.14.65

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.
@@ -17,195 +17,139 @@ const patientAppointmentConfirmedTemplate = `
17
17
  <meta charset="UTF-8">
18
18
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
19
  <title>Appointment Confirmed</title>
20
- <style>
21
- body {
22
- margin: 0;
23
- padding: 0;
24
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
25
- background: linear-gradient(135deg, #a48a76 0%, #67574A 100%);
26
- min-height: 100vh;
27
- }
28
- .email-container {
29
- max-width: 600px;
30
- margin: 0 auto;
31
- background: #ffffff;
32
- border-radius: 20px;
33
- overflow: hidden;
34
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
35
- margin-top: 40px;
36
- margin-bottom: 40px;
37
- }
38
- .header {
39
- background: linear-gradient(135deg, #a48a76 0%, #67574A 100%);
40
- padding: 40px 30px;
41
- text-align: center;
42
- color: white;
43
- }
44
- .header h1 {
45
- margin: 0;
46
- font-size: 28px;
47
- font-weight: 300;
48
- letter-spacing: 1px;
49
- }
50
- .header .subtitle {
51
- margin: 10px 0 0 0;
52
- font-size: 16px;
53
- opacity: 0.9;
54
- font-weight: 300;
55
- }
56
- .content {
57
- padding: 40px 30px;
58
- }
59
- .greeting {
60
- font-size: 18px;
61
- color: #333;
62
- margin-bottom: 25px;
63
- font-weight: 400;
64
- }
65
- .appointment-card {
66
- background: linear-gradient(135deg, #f8f6f5 0%, #f5f3f2 100%);
67
- border-radius: 15px;
68
- padding: 30px;
69
- margin: 25px 0;
70
- border-left: 5px solid #a48a76;
71
- }
72
- .appointment-title {
73
- font-size: 20px;
74
- color: #a48a76;
75
- margin-bottom: 20px;
76
- font-weight: 600;
77
- }
78
- .appointment-details {
79
- display: grid;
80
- gap: 15px;
81
- }
82
- .detail-row {
83
- display: flex;
84
- align-items: center;
85
- padding: 8px 0;
86
- }
87
- .detail-label {
88
- font-weight: 600;
89
- color: #555;
90
- min-width: 120px;
91
- font-size: 14px;
92
- }
93
- .detail-value {
94
- color: #333;
95
- font-size: 16px;
96
- font-weight: 500;
97
- }
98
- .procedure-name {
99
- color: #67574A;
100
- font-weight: 600;
101
- }
102
- .clinic-name {
103
- color: #a48a76;
104
- font-weight: 600;
105
- }
106
- .success-icon {
107
- text-align: center;
108
- margin: 20px 0;
109
- font-size: 48px;
110
- }
111
- .footer {
112
- background: #f8f9fa;
113
- padding: 25px 30px;
114
- text-align: center;
115
- color: #666;
116
- font-size: 14px;
117
- border-top: 1px solid #eee;
118
- }
119
- .logo {
120
- font-size: 24px;
121
- font-weight: 700;
122
- color: white;
123
- margin-bottom: 5px;
124
- }
125
- .divider {
126
- height: 2px;
127
- background: linear-gradient(90deg, #a48a76, #67574A);
128
- margin: 25px 0;
129
- border-radius: 1px;
130
- }
131
- .thank-you {
132
- background: linear-gradient(135deg, #f0ede8 0%, #ebe6e0 100%);
133
- border-radius: 15px;
134
- padding: 25px;
135
- margin: 25px 0;
136
- text-align: center;
137
- border-left: 5px solid #4CAF50;
138
- }
139
- </style>
20
+ <!--[if mso]>
21
+ <noscript>
22
+ <xml>
23
+ <o:OfficeDocumentSettings>
24
+ <o:PixelsPerInch>96</o:PixelsPerInch>
25
+ </o:OfficeDocumentSettings>
26
+ </xml>
27
+ </noscript>
28
+ <![endif]-->
140
29
  </head>
141
- <body>
142
- <div class="email-container">
143
- <div class="header">
144
- <div class="logo">MetaEstetics</div>
145
- <h1>Appointment Confirmed</h1>
146
- <div class="subtitle">Your Beauty Journey Awaits</div>
147
- </div>
148
-
149
- <div class="content">
150
- <div class="success-icon">✨</div>
151
-
152
- <div class="greeting">
153
- Dear <strong>{{patientName}}</strong>,
154
- </div>
155
-
156
- <p style="color: #555; font-size: 16px; line-height: 1.6; margin-bottom: 25px;">
157
- We're delighted to confirm your appointment! Your journey to enhanced beauty and confidence is just around the corner.
158
- </p>
159
-
160
- <div class="appointment-card">
161
- <div class="appointment-title">📅 Your Appointment Details</div>
162
- <div class="appointment-details">
163
- <div class="detail-row">
164
- <div class="detail-label">Procedure:</div>
165
- <div class="detail-value procedure-name">{{procedureName}}</div>
166
- </div>
167
- <div class="detail-row">
168
- <div class="detail-label">Date:</div>
169
- <div class="detail-value">{{appointmentDate}}</div>
170
- </div>
171
- <div class="detail-row">
172
- <div class="detail-label">Time:</div>
173
- <div class="detail-value">{{appointmentTime}}</div>
174
- </div>
175
- <div class="detail-row">
176
- <div class="detail-label">Practitioner:</div>
177
- <div class="detail-value">{{practitionerName}}</div>
178
- </div>
179
- <div class="detail-row">
180
- <div class="detail-label">Location:</div>
181
- <div class="detail-value clinic-name">{{clinicName}}</div>
182
- </div>
183
- </div>
184
- </div>
185
-
186
- <div class="divider"></div>
187
-
188
- <div class="thank-you">
189
- <h3 style="margin: 0 0 10px 0; color: #4caf50; font-weight: 600;">Thank You for Choosing MetaEstetics!</h3>
190
- <p style="margin: 0; color: #555; font-size: 14px;">
191
- We look forward to providing you with exceptional care and outstanding results.
192
- </p>
193
- </div>
194
-
195
- <p style="color: #555; font-size: 14px; line-height: 1.6; margin-top: 25px;">
196
- <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.
197
- </p>
198
- </div>
199
-
200
- <div class="footer">
201
- <p style="margin: 0 0 10px 0;">
202
- <strong>MetaEstetics</strong> - Premium Aesthetic Services
203
- </p>
204
- <p style="margin: 0; font-size: 12px; color: #999;">
205
- This is an automated message. Please do not reply to this email.
206
- </p>
207
- </div>
208
- </div>
30
+ <body style="margin: 0; padding: 0; background-color: #f8f6f5; font-family: Georgia, 'Times New Roman', serif;">
31
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color: #f8f6f5;">
32
+ <tr>
33
+ <td align="center" style="padding: 40px 20px;">
34
+ <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);">
35
+
36
+ <!-- Header -->
37
+ <tr>
38
+ <td style="padding: 48px 48px 32px 48px; border-bottom: 1px solid #f0ebe6;">
39
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
40
+ <tr>
41
+ <td>
42
+ <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>
43
+ </td>
44
+ </tr>
45
+ </table>
46
+ </td>
47
+ </tr>
48
+
49
+ <!-- Confirmed Banner -->
50
+ <tr>
51
+ <td style="padding: 0;">
52
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color: #00BB38;">
53
+ <tr>
54
+ <td style="padding: 20px 48px;">
55
+ <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>
56
+ </td>
57
+ </tr>
58
+ </table>
59
+ </td>
60
+ </tr>
61
+
62
+ <!-- Main Content -->
63
+ <tr>
64
+ <td style="padding: 40px 48px;">
65
+
66
+ <!-- Greeting -->
67
+ <p style="margin: 0 0 24px 0; font-size: 17px; color: #333333; line-height: 1.6; font-family: Georgia, 'Times New Roman', serif;">
68
+ Dear {{patientName}},
69
+ </p>
70
+
71
+ <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;">
72
+ Your appointment has been confirmed. We look forward to seeing you.
73
+ </p>
74
+
75
+ <!-- Appointment Details Card -->
76
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 32px; background-color: #faf9f7; border-left: 3px solid #00BB38;">
77
+ <tr>
78
+ <td style="padding: 24px;">
79
+ <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>
80
+ <p style="margin: 0 0 20px 0; font-size: 18px; color: #67574A; font-weight: 500; font-family: Georgia, 'Times New Roman', serif;">{{procedureName}}</p>
81
+
82
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
83
+ <tr>
84
+ <td style="padding-bottom: 16px;">
85
+ <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>
86
+ <p style="margin: 0; font-size: 15px; color: #333333; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">{{appointmentDate}}</p>
87
+ <p style="margin: 4px 0 0 0; font-size: 14px; color: #67574A; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">{{appointmentTime}}</p>
88
+ </td>
89
+ </tr>
90
+ <tr>
91
+ <td style="padding-bottom: 16px;">
92
+ <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>
93
+ <p style="margin: 0; font-size: 15px; color: #333333; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">{{practitionerName}}</p>
94
+ </td>
95
+ </tr>
96
+ <tr>
97
+ <td>
98
+ <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>
99
+ <p style="margin: 0; font-size: 15px; color: #333333; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">{{clinicName}}</p>
100
+ </td>
101
+ </tr>
102
+ </table>
103
+ </td>
104
+ </tr>
105
+ </table>
106
+
107
+ <!-- Divider -->
108
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 32px;">
109
+ <tr>
110
+ <td style="height: 1px; background-color: #e8e4df;"></td>
111
+ </tr>
112
+ </table>
113
+
114
+ <!-- Important Notice -->
115
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 24px;">
116
+ <tr>
117
+ <td style="padding: 20px 24px; background-color: #faf9f7; border-left: 3px solid #a48a76;">
118
+ <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>
119
+ <p style="margin: 0; font-size: 14px; color: #555555; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
120
+ Please arrive 15 minutes early. If you need to reschedule or cancel, contact us through the MetaEstetics app.
121
+ </p>
122
+ </td>
123
+ </tr>
124
+ </table>
125
+
126
+ <!-- Thank You -->
127
+ <p style="margin: 0; font-size: 14px; color: #868686; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
128
+ Thank you for choosing {{clinicName}}. We look forward to providing you with exceptional care.
129
+ </p>
130
+
131
+ </td>
132
+ </tr>
133
+
134
+ <!-- Footer -->
135
+ <tr>
136
+ <td style="padding: 32px 48px; background-color: #faf9f7; border-top: 1px solid #f0ebe6;">
137
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
138
+ <tr>
139
+ <td>
140
+ <p style="margin: 0 0 8px 0; font-size: 14px; font-weight: 500; color: #67574A; font-family: Georgia, 'Times New Roman', serif;">{{clinicName}}</p>
141
+ <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>
142
+ <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>
143
+ </td>
144
+ </tr>
145
+ </table>
146
+ </td>
147
+ </tr>
148
+
149
+ </table>
150
+ </td>
151
+ </tr>
152
+ </table>
209
153
  </body>
210
154
  </html>
211
155
  `;
@@ -539,27 +483,20 @@ const appointmentCancelledTemplate = `
539
483
  </table>
540
484
 
541
485
  <!-- Rebook Section -->
542
- <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 32px; background-color: #f0faf4; border-left: 3px solid #00BB38;">
486
+ <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 24px; background-color: #f0faf4; border-left: 3px solid #00BB38;">
543
487
  <tr>
544
- <td style="padding: 28px;">
545
- <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>
546
- <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;">
547
- We'd love to see you. Open the MetaEstetics app to browse available times and book a new appointment.
488
+ <td style="padding: 24px;">
489
+ <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>
490
+ <p style="margin: 0; font-size: 14px; color: #555555; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
491
+ We'd love to see you again. Open the MetaEstetics app to browse available times and book a new appointment.
548
492
  </p>
549
- <table role="presentation" cellspacing="0" cellpadding="0" border="0">
550
- <tr>
551
- <td style="background-color: #67574A; border-radius: 2px;">
552
- <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>
553
- </td>
554
- </tr>
555
- </table>
556
493
  </td>
557
494
  </tr>
558
495
  </table>
559
496
 
560
497
  <!-- Support Info -->
561
498
  <p style="margin: 0; font-size: 13px; color: #868686; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
562
- If you have any questions about this cancellation, please contact {{clinicName}} directly through the app.
499
+ If you have any questions about this cancellation, please contact {{clinicName}} through the MetaEstetics app.
563
500
  </p>
564
501
 
565
502
  </td>
@@ -700,31 +637,18 @@ const appointmentRescheduledProposalTemplate = `
700
637
  <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 32px; background-color: #faf9f7;">
701
638
  <tr>
702
639
  <td style="padding: 28px;">
703
- <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>
704
- <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;">
640
+ <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>
641
+ <p style="margin: 0; font-size: 14px; color: #555555; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
705
642
  Open the MetaEstetics app to accept or decline this reschedule request. Your appointment will remain pending until you respond.
706
643
  </p>
707
- <table role="presentation" cellspacing="0" cellpadding="0" border="0">
708
- <tr>
709
- <td style="background-color: #67574A; border-radius: 2px;">
710
- <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>
711
- </td>
712
- </tr>
713
- </table>
714
644
  </td>
715
645
  </tr>
716
646
  </table>
717
647
 
718
- <!-- Pending Notice -->
719
- <table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
720
- <tr>
721
- <td style="padding: 16px 20px; background-color: #fff8f0; border: 1px solid #f0e6d9; border-radius: 2px;">
722
- <p style="margin: 0; font-size: 13px; color: #a48a76; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
723
- <strong>Status:</strong> Pending your response. Please respond as soon as possible so we can confirm your appointment.
724
- </p>
725
- </td>
726
- </tr>
727
- </table>
648
+ <!-- Response Notice -->
649
+ <p style="margin: 0; font-size: 13px; color: #868686; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
650
+ Please respond at your earliest convenience so we can finalize your appointment. If you have questions, contact {{clinicName}} through the app.
651
+ </p>
728
652
 
729
653
  </td>
730
654
  </tr>
@@ -680,11 +680,23 @@ export class AppointmentService extends BaseService {
680
680
 
681
681
  /**
682
682
  * Cancels an appointment by an Admin/Clinic.
683
+ * @param appointmentId - The appointment ID to cancel
684
+ * @param reasonOrClinicId - Either a cancellation reason string, or clinicId (legacy parameter - will be ignored)
683
685
  */
684
- async cancelAppointmentAdmin(appointmentId: string, reason: string): Promise<Appointment> {
686
+ async cancelAppointmentAdmin(appointmentId: string, reasonOrClinicId?: string): Promise<Appointment> {
685
687
  console.log(`[APPOINTMENT_SERVICE] Admin canceling appointment: ${appointmentId}`);
688
+
689
+ // Detect if the second parameter looks like an ID rather than a reason
690
+ // IDs typically have no spaces and contain alphanumeric/dash/underscore patterns
691
+ const isLikelyId = reasonOrClinicId &&
692
+ !reasonOrClinicId.includes(' ') &&
693
+ /^[a-zA-Z0-9_-]+$/.test(reasonOrClinicId) &&
694
+ reasonOrClinicId.length > 15;
695
+
696
+ const cancellationReason = isLikelyId ? undefined : (reasonOrClinicId || undefined);
697
+
686
698
  return this.updateAppointmentStatus(appointmentId, AppointmentStatus.CANCELED_CLINIC, {
687
- cancellationReason: reason,
699
+ cancellationReason,
688
700
  canceledBy: 'clinic',
689
701
  });
690
702
  }