@blackcode_sa/metaestetics-api 1.7.32 → 1.7.34
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.
- package/dist/admin/index.d.mts +395 -54
- package/dist/admin/index.d.ts +395 -54
- package/dist/admin/index.js +3661 -2073
- package/dist/admin/index.mjs +3658 -2073
- package/package.json +1 -1
- package/src/admin/aggregation/practitioner-invite/practitioner-invite.aggregation.service.ts +811 -0
- package/src/admin/index.ts +20 -1
- package/src/admin/mailing/practitionerInvite/existing-practitioner-invite.mailing.ts +611 -0
- package/src/admin/mailing/practitionerInvite/templates/existing-practitioner-invitation.template.ts +155 -0
- package/src/admin/mailing/practitionerInvite/templates/invite-accepted-notification.template.ts +228 -0
- package/src/admin/mailing/practitionerInvite/templates/invite-rejected-notification.template.ts +242 -0
- package/src/types/calendar/index.ts +2 -2
package/dist/admin/index.d.ts
CHANGED
|
@@ -1035,6 +1035,70 @@ declare enum ClinicTag {
|
|
|
1035
1035
|
HOLIDAY_HOURS = "holiday_hours"
|
|
1036
1036
|
}
|
|
1037
1037
|
|
|
1038
|
+
/**
|
|
1039
|
+
* Enum for practitioner invite status
|
|
1040
|
+
*/
|
|
1041
|
+
declare enum PractitionerInviteStatus {
|
|
1042
|
+
PENDING = "pending",
|
|
1043
|
+
ACCEPTED = "accepted",
|
|
1044
|
+
REJECTED = "rejected",
|
|
1045
|
+
CANCELLED = "cancelled"
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Interface for proposed working hours in practitioner invite
|
|
1049
|
+
*/
|
|
1050
|
+
interface ProposedWorkingHours {
|
|
1051
|
+
monday: {
|
|
1052
|
+
start: string;
|
|
1053
|
+
end: string;
|
|
1054
|
+
} | null;
|
|
1055
|
+
tuesday: {
|
|
1056
|
+
start: string;
|
|
1057
|
+
end: string;
|
|
1058
|
+
} | null;
|
|
1059
|
+
wednesday: {
|
|
1060
|
+
start: string;
|
|
1061
|
+
end: string;
|
|
1062
|
+
} | null;
|
|
1063
|
+
thursday: {
|
|
1064
|
+
start: string;
|
|
1065
|
+
end: string;
|
|
1066
|
+
} | null;
|
|
1067
|
+
friday: {
|
|
1068
|
+
start: string;
|
|
1069
|
+
end: string;
|
|
1070
|
+
} | null;
|
|
1071
|
+
saturday: {
|
|
1072
|
+
start: string;
|
|
1073
|
+
end: string;
|
|
1074
|
+
} | null;
|
|
1075
|
+
sunday: {
|
|
1076
|
+
start: string;
|
|
1077
|
+
end: string;
|
|
1078
|
+
} | null;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Main interface for practitioner invite
|
|
1082
|
+
*/
|
|
1083
|
+
interface PractitionerInvite {
|
|
1084
|
+
id: string;
|
|
1085
|
+
practitionerId: string;
|
|
1086
|
+
clinicId: string;
|
|
1087
|
+
practitionerInfo: PractitionerProfileInfo;
|
|
1088
|
+
clinicInfo: ClinicInfo;
|
|
1089
|
+
proposedWorkingHours: ProposedWorkingHours;
|
|
1090
|
+
status: PractitionerInviteStatus;
|
|
1091
|
+
invitedBy: string;
|
|
1092
|
+
message?: string | null;
|
|
1093
|
+
rejectionReason?: string | null;
|
|
1094
|
+
cancelReason?: string | null;
|
|
1095
|
+
createdAt: Timestamp;
|
|
1096
|
+
updatedAt: Timestamp;
|
|
1097
|
+
acceptedAt?: Timestamp | null;
|
|
1098
|
+
rejectedAt?: Timestamp | null;
|
|
1099
|
+
cancelledAt?: Timestamp | null;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1038
1102
|
/**
|
|
1039
1103
|
* Interface for clinic contact information
|
|
1040
1104
|
*/
|
|
@@ -1919,6 +1983,335 @@ declare class PractitionerAggregationService {
|
|
|
1919
1983
|
inactivateProceduresForPractitioner(procedureIds: string[]): Promise<void>;
|
|
1920
1984
|
}
|
|
1921
1985
|
|
|
1986
|
+
/**
|
|
1987
|
+
* Minimal interface for the new mailgun.js client's messages API
|
|
1988
|
+
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
1989
|
+
* or provides clearer typing if it is.
|
|
1990
|
+
*/
|
|
1991
|
+
interface NewMailgunMessagesAPI$2 {
|
|
1992
|
+
create(domain: string, data: any): Promise<any>;
|
|
1993
|
+
}
|
|
1994
|
+
interface NewMailgunClient$2 {
|
|
1995
|
+
messages: NewMailgunMessagesAPI$2;
|
|
1996
|
+
}
|
|
1997
|
+
/**
|
|
1998
|
+
* Base mailing service class that provides common functionality for all mailing services
|
|
1999
|
+
* This version is updated to expect a mailgun.js v10+ client.
|
|
2000
|
+
*/
|
|
2001
|
+
declare class BaseMailingService {
|
|
2002
|
+
protected db: FirebaseFirestore.Firestore;
|
|
2003
|
+
protected mailgunClient: NewMailgunClient$2;
|
|
2004
|
+
/**
|
|
2005
|
+
* Constructor for BaseMailingService
|
|
2006
|
+
* @param firestore Firestore instance provided by the caller
|
|
2007
|
+
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2008
|
+
*/
|
|
2009
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$2);
|
|
2010
|
+
/**
|
|
2011
|
+
* Sends an email using the new Mailgun client API.
|
|
2012
|
+
* @param domain The Mailgun domain to send from (e.g., mg.metaesthetics.net)
|
|
2013
|
+
* @param data Email data to send, compatible with mailgun.js messages.create API
|
|
2014
|
+
* @returns Promise with the sending result
|
|
2015
|
+
*/
|
|
2016
|
+
protected sendEmail(domain: string, // The new API requires the domain as the first argument to messages.create
|
|
2017
|
+
data: any): Promise<any>;
|
|
2018
|
+
/**
|
|
2019
|
+
* Logs email sending attempt to Firestore for tracking
|
|
2020
|
+
* @param emailData Email data that was sent
|
|
2021
|
+
* @param success Whether the email was sent successfully
|
|
2022
|
+
* @param error Error object if the email failed to send
|
|
2023
|
+
*/
|
|
2024
|
+
protected logEmailAttempt(emailData: {
|
|
2025
|
+
to: string;
|
|
2026
|
+
subject: string;
|
|
2027
|
+
templateName?: string;
|
|
2028
|
+
}, success: boolean, error?: any): Promise<void>;
|
|
2029
|
+
/**
|
|
2030
|
+
* Renders a simple HTML email template with variables
|
|
2031
|
+
* @param template HTML template string
|
|
2032
|
+
* @param variables Key-value pairs to replace in the template
|
|
2033
|
+
* @returns Rendered HTML string
|
|
2034
|
+
*/
|
|
2035
|
+
protected renderTemplate(template: string, variables: Record<string, string>): string;
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
interface NewMailgunMessagesAPI$1 {
|
|
2039
|
+
create(domain: string, data: any): Promise<any>;
|
|
2040
|
+
}
|
|
2041
|
+
interface NewMailgunClient$1 {
|
|
2042
|
+
messages: NewMailgunMessagesAPI$1;
|
|
2043
|
+
}
|
|
2044
|
+
/**
|
|
2045
|
+
* Interface for sending practitioner invitation email data
|
|
2046
|
+
*/
|
|
2047
|
+
interface ExistingPractitionerInviteEmailData {
|
|
2048
|
+
/** The practitioner invite object */
|
|
2049
|
+
invite: PractitionerInvite;
|
|
2050
|
+
/** Practitioner details */
|
|
2051
|
+
practitioner: {
|
|
2052
|
+
firstName: string;
|
|
2053
|
+
lastName: string;
|
|
2054
|
+
email: string;
|
|
2055
|
+
specialties?: string[];
|
|
2056
|
+
profileImageUrl?: string | null;
|
|
2057
|
+
};
|
|
2058
|
+
/** Clinic details */
|
|
2059
|
+
clinic: {
|
|
2060
|
+
name: string;
|
|
2061
|
+
address: string;
|
|
2062
|
+
contactEmail: string;
|
|
2063
|
+
contactPhone?: string;
|
|
2064
|
+
};
|
|
2065
|
+
/** URLs for accept/reject actions */
|
|
2066
|
+
urls: {
|
|
2067
|
+
acceptUrl: string;
|
|
2068
|
+
rejectUrl: string;
|
|
2069
|
+
};
|
|
2070
|
+
/** Configuration options */
|
|
2071
|
+
options?: {
|
|
2072
|
+
customSubject?: string;
|
|
2073
|
+
fromAddress?: string;
|
|
2074
|
+
mailgunDomain?: string;
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Interface for clinic admin notification email data
|
|
2079
|
+
*/
|
|
2080
|
+
interface ClinicAdminNotificationData {
|
|
2081
|
+
/** The practitioner invite object */
|
|
2082
|
+
invite: PractitionerInvite;
|
|
2083
|
+
/** Practitioner details */
|
|
2084
|
+
practitioner: {
|
|
2085
|
+
firstName: string;
|
|
2086
|
+
lastName: string;
|
|
2087
|
+
specialties?: string[];
|
|
2088
|
+
profileImageUrl?: string | null;
|
|
2089
|
+
experienceYears?: number;
|
|
2090
|
+
};
|
|
2091
|
+
/** Clinic details */
|
|
2092
|
+
clinic: {
|
|
2093
|
+
name: string;
|
|
2094
|
+
adminName?: string;
|
|
2095
|
+
adminEmail: string;
|
|
2096
|
+
};
|
|
2097
|
+
/** Additional context */
|
|
2098
|
+
context: {
|
|
2099
|
+
invitationDate: string;
|
|
2100
|
+
responseDate: string;
|
|
2101
|
+
rejectionReason?: string;
|
|
2102
|
+
};
|
|
2103
|
+
/** URLs for dashboard access */
|
|
2104
|
+
urls: {
|
|
2105
|
+
clinicDashboardUrl: string;
|
|
2106
|
+
practitionerProfileUrl?: string;
|
|
2107
|
+
findPractitionersUrl?: string;
|
|
2108
|
+
};
|
|
2109
|
+
/** Configuration options */
|
|
2110
|
+
options?: {
|
|
2111
|
+
customSubject?: string;
|
|
2112
|
+
fromAddress?: string;
|
|
2113
|
+
mailgunDomain?: string;
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
/**
|
|
2117
|
+
* Service for sending existing practitioner invitation emails
|
|
2118
|
+
* This service handles the email flow for inviting active practitioners to join clinics
|
|
2119
|
+
*/
|
|
2120
|
+
declare class ExistingPractitionerInviteMailingService extends BaseMailingService {
|
|
2121
|
+
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
2122
|
+
private readonly DEFAULT_FROM_ADDRESS;
|
|
2123
|
+
/**
|
|
2124
|
+
* Constructor for ExistingPractitionerInviteMailingService
|
|
2125
|
+
* @param firestore Firestore instance provided by the caller
|
|
2126
|
+
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2127
|
+
*/
|
|
2128
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$1);
|
|
2129
|
+
/**
|
|
2130
|
+
* Sends an invitation email to an existing practitioner
|
|
2131
|
+
* @param data The invitation email data
|
|
2132
|
+
* @returns Promise resolved when email is sent
|
|
2133
|
+
*/
|
|
2134
|
+
sendPractitionerInvitationEmail(data: ExistingPractitionerInviteEmailData): Promise<any>;
|
|
2135
|
+
/**
|
|
2136
|
+
* Sends a notification email to clinic admin when practitioner accepts invitation
|
|
2137
|
+
* @param data The notification email data
|
|
2138
|
+
* @returns Promise resolved when email is sent
|
|
2139
|
+
*/
|
|
2140
|
+
sendAcceptedNotificationEmail(data: ClinicAdminNotificationData): Promise<any>;
|
|
2141
|
+
/**
|
|
2142
|
+
* Sends a notification email to clinic admin when practitioner rejects invitation
|
|
2143
|
+
* @param data The notification email data
|
|
2144
|
+
* @returns Promise resolved when email is sent
|
|
2145
|
+
*/
|
|
2146
|
+
sendRejectedNotificationEmail(data: ClinicAdminNotificationData): Promise<any>;
|
|
2147
|
+
/**
|
|
2148
|
+
* Handles the practitioner invite creation event
|
|
2149
|
+
* Fetches necessary data and sends the invitation email to the practitioner
|
|
2150
|
+
* @param invite The practitioner invite object
|
|
2151
|
+
* @param mailgunConfig Mailgun configuration
|
|
2152
|
+
* @returns Promise resolved when the email is sent
|
|
2153
|
+
*/
|
|
2154
|
+
handleInviteCreationEvent(invite: PractitionerInvite, mailgunConfig: {
|
|
2155
|
+
fromAddress: string;
|
|
2156
|
+
domain: string;
|
|
2157
|
+
acceptUrl: string;
|
|
2158
|
+
rejectUrl: string;
|
|
2159
|
+
}): Promise<void>;
|
|
2160
|
+
/**
|
|
2161
|
+
* Formats working hours for display in emails
|
|
2162
|
+
* @param workingHours The working hours object
|
|
2163
|
+
* @returns Formatted string representation
|
|
2164
|
+
*/
|
|
2165
|
+
private formatWorkingHours;
|
|
2166
|
+
/**
|
|
2167
|
+
* Formats clinic address for display
|
|
2168
|
+
* @param location The clinic location object
|
|
2169
|
+
* @returns Formatted address string
|
|
2170
|
+
*/
|
|
2171
|
+
private formatClinicAddress;
|
|
2172
|
+
/**
|
|
2173
|
+
* Fetches a practitioner by ID
|
|
2174
|
+
* @param practitionerId The practitioner ID
|
|
2175
|
+
* @returns The practitioner or null if not found
|
|
2176
|
+
*/
|
|
2177
|
+
private fetchPractitionerById;
|
|
2178
|
+
/**
|
|
2179
|
+
* Fetches a clinic by ID
|
|
2180
|
+
* @param clinicId The clinic ID
|
|
2181
|
+
* @returns The clinic or null if not found
|
|
2182
|
+
*/
|
|
2183
|
+
private fetchClinicById;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* @class PractitionerInviteAggregationService
|
|
2188
|
+
* @description Handles aggregation tasks and side effects related to practitioner invite lifecycle events.
|
|
2189
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2190
|
+
* triggered by changes in the practitioner-invites collection.
|
|
2191
|
+
*/
|
|
2192
|
+
declare class PractitionerInviteAggregationService {
|
|
2193
|
+
private db;
|
|
2194
|
+
private mailingService?;
|
|
2195
|
+
/**
|
|
2196
|
+
* Constructor for PractitionerInviteAggregationService.
|
|
2197
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2198
|
+
* @param mailingService Optional mailing service for sending emails
|
|
2199
|
+
*/
|
|
2200
|
+
constructor(firestore?: admin.firestore.Firestore, mailingService?: ExistingPractitionerInviteMailingService);
|
|
2201
|
+
/**
|
|
2202
|
+
* Handles side effects when a practitioner invite is first created.
|
|
2203
|
+
* This function would typically be called by a Firestore onCreate trigger.
|
|
2204
|
+
* @param {PractitionerInvite} invite - The newly created PractitionerInvite object.
|
|
2205
|
+
* @param {object} emailConfig - Optional email configuration for sending invite emails
|
|
2206
|
+
* @returns {Promise<void>}
|
|
2207
|
+
*/
|
|
2208
|
+
handleInviteCreate(invite: PractitionerInvite, emailConfig?: {
|
|
2209
|
+
fromAddress: string;
|
|
2210
|
+
domain: string;
|
|
2211
|
+
acceptUrl: string;
|
|
2212
|
+
rejectUrl: string;
|
|
2213
|
+
}): Promise<void>;
|
|
2214
|
+
/**
|
|
2215
|
+
* Handles side effects when a practitioner invite is updated.
|
|
2216
|
+
* This function would typically be called by a Firestore onUpdate trigger.
|
|
2217
|
+
* @param {PractitionerInvite} before - The PractitionerInvite object before the update.
|
|
2218
|
+
* @param {PractitionerInvite} after - The PractitionerInvite object after the update.
|
|
2219
|
+
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2220
|
+
* @returns {Promise<void>}
|
|
2221
|
+
*/
|
|
2222
|
+
handleInviteUpdate(before: PractitionerInvite, after: PractitionerInvite, emailConfig?: {
|
|
2223
|
+
fromAddress: string;
|
|
2224
|
+
domain: string;
|
|
2225
|
+
clinicDashboardUrl: string;
|
|
2226
|
+
practitionerProfileUrl?: string;
|
|
2227
|
+
findPractitionersUrl?: string;
|
|
2228
|
+
}): Promise<void>;
|
|
2229
|
+
/**
|
|
2230
|
+
* Handles side effects when a practitioner invite is deleted.
|
|
2231
|
+
* @param deletedInvite - The PractitionerInvite object that was deleted.
|
|
2232
|
+
* @returns {Promise<void>}
|
|
2233
|
+
*/
|
|
2234
|
+
handleInviteDelete(deletedInvite: PractitionerInvite): Promise<void>;
|
|
2235
|
+
/**
|
|
2236
|
+
* Handles the business logic when a practitioner accepts an invite.
|
|
2237
|
+
* This includes adding the practitioner to the clinic and the clinic to the practitioner.
|
|
2238
|
+
* @param {PractitionerInvite} invite - The accepted invite
|
|
2239
|
+
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2240
|
+
* @returns {Promise<void>}
|
|
2241
|
+
*/
|
|
2242
|
+
private handleInviteAccepted;
|
|
2243
|
+
/**
|
|
2244
|
+
* Handles the business logic when a practitioner rejects an invite.
|
|
2245
|
+
* @param {PractitionerInvite} invite - The rejected invite
|
|
2246
|
+
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2247
|
+
* @returns {Promise<void>}
|
|
2248
|
+
*/
|
|
2249
|
+
private handleInviteRejected;
|
|
2250
|
+
/**
|
|
2251
|
+
* Handles the business logic when an invite is cancelled by admin.
|
|
2252
|
+
* @param {PractitionerInvite} invite - The cancelled invite
|
|
2253
|
+
* @returns {Promise<void>}
|
|
2254
|
+
*/
|
|
2255
|
+
private handleInviteCancelled;
|
|
2256
|
+
/**
|
|
2257
|
+
* Adds practitioner information to a clinic when an invite is accepted.
|
|
2258
|
+
* @param clinicId - ID of the clinic to update
|
|
2259
|
+
* @param doctorInfo - Doctor information to add to the clinic
|
|
2260
|
+
* @returns {Promise<void>}
|
|
2261
|
+
*/
|
|
2262
|
+
private addPractitionerToClinic;
|
|
2263
|
+
/**
|
|
2264
|
+
* Updates practitioner information in a clinic.
|
|
2265
|
+
* @param clinicId - ID of the clinic to update
|
|
2266
|
+
* @param doctorInfo - Updated doctor information
|
|
2267
|
+
* @returns {Promise<void>}
|
|
2268
|
+
*/
|
|
2269
|
+
private updatePractitionerInfoInClinic;
|
|
2270
|
+
/**
|
|
2271
|
+
* Adds a clinic to a practitioner's profile with working hours from the invite.
|
|
2272
|
+
* @param {string} practitionerId - The practitioner ID
|
|
2273
|
+
* @param {ClinicInfo} clinicInfo - The clinic information
|
|
2274
|
+
* @param {PractitionerInvite} invite - The accepted invite containing working hours
|
|
2275
|
+
* @returns {Promise<void>}
|
|
2276
|
+
*/
|
|
2277
|
+
private addClinicToPractitioner;
|
|
2278
|
+
/**
|
|
2279
|
+
* Updates the working hours for an existing practitioner-clinic relationship.
|
|
2280
|
+
* @param {string} practitionerId - The practitioner ID
|
|
2281
|
+
* @param {PractitionerInvite} invite - The accepted invite containing new working hours
|
|
2282
|
+
* @returns {Promise<void>}
|
|
2283
|
+
*/
|
|
2284
|
+
private updatePractitionerWorkingHours;
|
|
2285
|
+
/**
|
|
2286
|
+
* Fetches a practitioner by ID.
|
|
2287
|
+
* @param practitionerId The practitioner ID.
|
|
2288
|
+
* @returns {Promise<Practitioner | null>} The practitioner or null if not found.
|
|
2289
|
+
*/
|
|
2290
|
+
private fetchPractitionerById;
|
|
2291
|
+
/**
|
|
2292
|
+
* Fetches a clinic by ID.
|
|
2293
|
+
* @param clinicId The clinic ID.
|
|
2294
|
+
* @returns {Promise<Clinic | null>} The clinic or null if not found.
|
|
2295
|
+
*/
|
|
2296
|
+
private fetchClinicById;
|
|
2297
|
+
/**
|
|
2298
|
+
* Sends acceptance notification email to clinic admin
|
|
2299
|
+
* @param invite The accepted invite
|
|
2300
|
+
* @param practitioner The practitioner who accepted
|
|
2301
|
+
* @param clinic The clinic that sent the invite
|
|
2302
|
+
* @param emailConfig Email configuration
|
|
2303
|
+
*/
|
|
2304
|
+
private sendAcceptanceNotificationEmail;
|
|
2305
|
+
/**
|
|
2306
|
+
* Sends rejection notification email to clinic admin
|
|
2307
|
+
* @param invite The rejected invite
|
|
2308
|
+
* @param practitioner The practitioner who rejected
|
|
2309
|
+
* @param clinic The clinic that sent the invite
|
|
2310
|
+
* @param emailConfig Email configuration
|
|
2311
|
+
*/
|
|
2312
|
+
private sendRejectionNotificationEmail;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
1922
2315
|
/**
|
|
1923
2316
|
* @class ProcedureAggregationService
|
|
1924
2317
|
* @description Handles aggregation tasks related to procedure data updates/deletions.
|
|
@@ -2249,58 +2642,6 @@ declare class ReviewsAggregationService {
|
|
|
2249
2642
|
calculateEntityReviewInfo(entityId: string, entityType: "clinic" | "practitioner" | "procedure"): Promise<ClinicReviewInfo | PractitionerReviewInfo | ProcedureReviewInfo>;
|
|
2250
2643
|
}
|
|
2251
2644
|
|
|
2252
|
-
/**
|
|
2253
|
-
* Minimal interface for the new mailgun.js client's messages API
|
|
2254
|
-
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
2255
|
-
* or provides clearer typing if it is.
|
|
2256
|
-
*/
|
|
2257
|
-
interface NewMailgunMessagesAPI$1 {
|
|
2258
|
-
create(domain: string, data: any): Promise<any>;
|
|
2259
|
-
}
|
|
2260
|
-
interface NewMailgunClient$1 {
|
|
2261
|
-
messages: NewMailgunMessagesAPI$1;
|
|
2262
|
-
}
|
|
2263
|
-
/**
|
|
2264
|
-
* Base mailing service class that provides common functionality for all mailing services
|
|
2265
|
-
* This version is updated to expect a mailgun.js v10+ client.
|
|
2266
|
-
*/
|
|
2267
|
-
declare class BaseMailingService {
|
|
2268
|
-
protected db: FirebaseFirestore.Firestore;
|
|
2269
|
-
protected mailgunClient: NewMailgunClient$1;
|
|
2270
|
-
/**
|
|
2271
|
-
* Constructor for BaseMailingService
|
|
2272
|
-
* @param firestore Firestore instance provided by the caller
|
|
2273
|
-
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2274
|
-
*/
|
|
2275
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$1);
|
|
2276
|
-
/**
|
|
2277
|
-
* Sends an email using the new Mailgun client API.
|
|
2278
|
-
* @param domain The Mailgun domain to send from (e.g., mg.metaesthetics.net)
|
|
2279
|
-
* @param data Email data to send, compatible with mailgun.js messages.create API
|
|
2280
|
-
* @returns Promise with the sending result
|
|
2281
|
-
*/
|
|
2282
|
-
protected sendEmail(domain: string, // The new API requires the domain as the first argument to messages.create
|
|
2283
|
-
data: any): Promise<any>;
|
|
2284
|
-
/**
|
|
2285
|
-
* Logs email sending attempt to Firestore for tracking
|
|
2286
|
-
* @param emailData Email data that was sent
|
|
2287
|
-
* @param success Whether the email was sent successfully
|
|
2288
|
-
* @param error Error object if the email failed to send
|
|
2289
|
-
*/
|
|
2290
|
-
protected logEmailAttempt(emailData: {
|
|
2291
|
-
to: string;
|
|
2292
|
-
subject: string;
|
|
2293
|
-
templateName?: string;
|
|
2294
|
-
}, success: boolean, error?: any): Promise<void>;
|
|
2295
|
-
/**
|
|
2296
|
-
* Renders a simple HTML email template with variables
|
|
2297
|
-
* @param template HTML template string
|
|
2298
|
-
* @param variables Key-value pairs to replace in the template
|
|
2299
|
-
* @returns Rendered HTML string
|
|
2300
|
-
*/
|
|
2301
|
-
protected renderTemplate(template: string, variables: Record<string, string>): string;
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
2645
|
interface NewMailgunMessagesAPI {
|
|
2305
2646
|
create(domain: string, data: any): Promise<any>;
|
|
2306
2647
|
}
|
|
@@ -2887,7 +3228,7 @@ interface ReviewAddedEmailData extends AppointmentEmailDataBase {
|
|
|
2887
3228
|
*/
|
|
2888
3229
|
declare class AppointmentMailingService extends BaseMailingService {
|
|
2889
3230
|
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
2890
|
-
constructor(firestore: admin.firestore.Firestore, mailgunClient: NewMailgunClient$
|
|
3231
|
+
constructor(firestore: admin.firestore.Firestore, mailgunClient: NewMailgunClient$2);
|
|
2891
3232
|
sendAppointmentConfirmedEmail(data: AppointmentConfirmationEmailData): Promise<any>;
|
|
2892
3233
|
sendAppointmentRequestedEmailToClinic(data: AppointmentRequestedEmailData): Promise<any>;
|
|
2893
3234
|
sendAppointmentCancelledEmail(data: AppointmentCancellationEmailData): Promise<any>;
|
|
@@ -2904,4 +3245,4 @@ declare class AppointmentMailingService extends BaseMailingService {
|
|
|
2904
3245
|
*/
|
|
2905
3246
|
declare function freeConsultationInfrastructure(db?: admin.firestore.Firestore): Promise<boolean>;
|
|
2906
3247
|
|
|
2907
|
-
export { APPOINTMENTS_COLLECTION, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentMediaItem, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type CreateAppointmentData, type CreateAppointmentHttpData, type DoctorInfo, DocumentManagerAdminService, type FilledDocument, FilledFormsAggregationService, type InitializeAppointmentFormsResult, type LinkedFormInfo, Logger, MediaType, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientReviewInfo, PaymentStatus, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, PractitionerInviteMailingService, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureExtendedInfo, type ProcedureSummaryInfo, type Review, type ReviewAddedEmailData, type ReviewRequestEmailData, ReviewsAggregationService, type SearchAppointmentsParams, type TimeInterval, type UpdateAppointmentData, UserRole, freeConsultationInfrastructure };
|
|
3248
|
+
export { APPOINTMENTS_COLLECTION, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentMediaItem, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type CreateAppointmentData, type CreateAppointmentHttpData, type DoctorInfo, DocumentManagerAdminService, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type InitializeAppointmentFormsResult, type LinkedFormInfo, Logger, MediaType, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientReviewInfo, PaymentStatus, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, type PractitionerInvite, PractitionerInviteAggregationService, PractitionerInviteMailingService, PractitionerInviteStatus, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureExtendedInfo, type ProcedureSummaryInfo, type Review, type ReviewAddedEmailData, type ReviewRequestEmailData, ReviewsAggregationService, type SearchAppointmentsParams, type TimeInterval, type UpdateAppointmentData, UserRole, freeConsultationInfrastructure };
|