@blackcode_sa/metaestetics-api 1.14.28 → 1.14.32
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 +133 -15
- package/dist/admin/index.d.ts +133 -15
- package/dist/admin/index.js +413 -6
- package/dist/admin/index.mjs +410 -6
- package/dist/index.js +24 -2
- package/dist/index.mjs +24 -2
- package/package.json +1 -1
- package/src/admin/booking/booking.admin.ts +42 -6
- package/src/admin/index.ts +2 -0
- package/src/admin/mailing/README.md +44 -0
- package/src/admin/mailing/index.ts +1 -0
- package/src/admin/mailing/patientInvite/index.ts +2 -0
- package/src/admin/mailing/patientInvite/patientInvite.mailing.ts +415 -0
- package/src/admin/mailing/patientInvite/templates/invitation.template.ts +120 -0
- package/src/services/calendar/utils/calendar-event.utils.ts +32 -2
package/dist/admin/index.d.mts
CHANGED
|
@@ -2030,6 +2030,49 @@ interface PatientRequirementInstance {
|
|
|
2030
2030
|
*/
|
|
2031
2031
|
declare const PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
2032
2032
|
|
|
2033
|
+
declare const INVITE_TOKENS_COLLECTION = "inviteTokens";
|
|
2034
|
+
/**
|
|
2035
|
+
* @enum PatientTokenStatus
|
|
2036
|
+
* @description Represents the status of a patient registration token.
|
|
2037
|
+
* @property {string} ACTIVE - The token is active and can be used for registration.
|
|
2038
|
+
* @property {string} USED - The token has been used and is no longer valid.
|
|
2039
|
+
* @property {string} EXPIRED - The token has expired and is no longer valid.
|
|
2040
|
+
*/
|
|
2041
|
+
declare enum PatientTokenStatus {
|
|
2042
|
+
ACTIVE = "active",
|
|
2043
|
+
USED = "used",
|
|
2044
|
+
EXPIRED = "expired"
|
|
2045
|
+
}
|
|
2046
|
+
/**
|
|
2047
|
+
* @interface PatientToken
|
|
2048
|
+
* @description Represents a registration token for a patient to claim their profile.
|
|
2049
|
+
* These tokens are stored in a subcollection under the patient's profile.
|
|
2050
|
+
* @property {string} id - The unique identifier for the token document.
|
|
2051
|
+
* @property {string} token - The unique token string (e.g., a 6-character code).
|
|
2052
|
+
* @property {string} patientId - The ID of the patient profile this token is for.
|
|
2053
|
+
* @property {string} email - The email address the invitation was sent to.
|
|
2054
|
+
* @property {string} clinicId - The ID of the clinic that created the invitation.
|
|
2055
|
+
* @property {PatientTokenStatus} status - The current status of the token.
|
|
2056
|
+
* @property {string} createdBy - The ID of the admin user who created the token.
|
|
2057
|
+
* @property {Timestamp} createdAt - The timestamp when the token was created.
|
|
2058
|
+
* @property {Timestamp} expiresAt - The timestamp when the token expires.
|
|
2059
|
+
* @property {string} [usedBy] - The ID of the user who used the token (optional).
|
|
2060
|
+
* @property {Timestamp} [usedAt] - The timestamp when the token was used (optional).
|
|
2061
|
+
*/
|
|
2062
|
+
interface PatientToken {
|
|
2063
|
+
id: string;
|
|
2064
|
+
token: string;
|
|
2065
|
+
patientId: string;
|
|
2066
|
+
email: string;
|
|
2067
|
+
clinicId: string;
|
|
2068
|
+
status: PatientTokenStatus;
|
|
2069
|
+
createdBy: string;
|
|
2070
|
+
createdAt: Timestamp;
|
|
2071
|
+
expiresAt: Timestamp;
|
|
2072
|
+
usedBy?: string;
|
|
2073
|
+
usedAt?: Timestamp;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2033
2076
|
/**
|
|
2034
2077
|
* Base metrics interface with common properties
|
|
2035
2078
|
*/
|
|
@@ -3085,11 +3128,11 @@ type Notification = PreRequirementNotification | PostRequirementNotification | R
|
|
|
3085
3128
|
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
3086
3129
|
* or provides clearer typing if it is.
|
|
3087
3130
|
*/
|
|
3088
|
-
interface NewMailgunMessagesAPI$
|
|
3131
|
+
interface NewMailgunMessagesAPI$3 {
|
|
3089
3132
|
create(domain: string, data: any): Promise<any>;
|
|
3090
3133
|
}
|
|
3091
|
-
interface NewMailgunClient$
|
|
3092
|
-
messages: NewMailgunMessagesAPI$
|
|
3134
|
+
interface NewMailgunClient$3 {
|
|
3135
|
+
messages: NewMailgunMessagesAPI$3;
|
|
3093
3136
|
}
|
|
3094
3137
|
/**
|
|
3095
3138
|
* Base mailing service class that provides common functionality for all mailing services
|
|
@@ -3097,13 +3140,13 @@ interface NewMailgunClient$2 {
|
|
|
3097
3140
|
*/
|
|
3098
3141
|
declare class BaseMailingService {
|
|
3099
3142
|
protected db: FirebaseFirestore.Firestore;
|
|
3100
|
-
protected mailgunClient: NewMailgunClient$
|
|
3143
|
+
protected mailgunClient: NewMailgunClient$3;
|
|
3101
3144
|
/**
|
|
3102
3145
|
* Constructor for BaseMailingService
|
|
3103
3146
|
* @param firestore Firestore instance provided by the caller
|
|
3104
3147
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
3105
3148
|
*/
|
|
3106
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$
|
|
3149
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$3);
|
|
3107
3150
|
/**
|
|
3108
3151
|
* Sends an email using the new Mailgun client API.
|
|
3109
3152
|
* @param domain The Mailgun domain to send from (e.g., mg.metaesthetics.net)
|
|
@@ -3132,11 +3175,11 @@ declare class BaseMailingService {
|
|
|
3132
3175
|
protected renderTemplate(template: string, variables: Record<string, string>): string;
|
|
3133
3176
|
}
|
|
3134
3177
|
|
|
3135
|
-
interface NewMailgunMessagesAPI$
|
|
3178
|
+
interface NewMailgunMessagesAPI$2 {
|
|
3136
3179
|
create(domain: string, data: any): Promise<any>;
|
|
3137
3180
|
}
|
|
3138
|
-
interface NewMailgunClient$
|
|
3139
|
-
messages: NewMailgunMessagesAPI$
|
|
3181
|
+
interface NewMailgunClient$2 {
|
|
3182
|
+
messages: NewMailgunMessagesAPI$2;
|
|
3140
3183
|
}
|
|
3141
3184
|
/**
|
|
3142
3185
|
* Interface for the data required to send a practitioner invitation email
|
|
@@ -3182,7 +3225,7 @@ declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
|
3182
3225
|
* @param firestore Firestore instance provided by the caller
|
|
3183
3226
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
3184
3227
|
*/
|
|
3185
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$
|
|
3228
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$2);
|
|
3186
3229
|
/**
|
|
3187
3230
|
* Sends a practitioner invitation email
|
|
3188
3231
|
* @param data The practitioner invitation data
|
|
@@ -3205,11 +3248,11 @@ declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
|
3205
3248
|
}): Promise<void>;
|
|
3206
3249
|
}
|
|
3207
3250
|
|
|
3208
|
-
interface NewMailgunMessagesAPI {
|
|
3251
|
+
interface NewMailgunMessagesAPI$1 {
|
|
3209
3252
|
create(domain: string, data: any): Promise<any>;
|
|
3210
3253
|
}
|
|
3211
|
-
interface NewMailgunClient {
|
|
3212
|
-
messages: NewMailgunMessagesAPI;
|
|
3254
|
+
interface NewMailgunClient$1 {
|
|
3255
|
+
messages: NewMailgunMessagesAPI$1;
|
|
3213
3256
|
}
|
|
3214
3257
|
/**
|
|
3215
3258
|
* Interface for sending practitioner invitation email data
|
|
@@ -3295,7 +3338,7 @@ declare class ExistingPractitionerInviteMailingService extends BaseMailingServic
|
|
|
3295
3338
|
* @param firestore Firestore instance provided by the caller
|
|
3296
3339
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
3297
3340
|
*/
|
|
3298
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient);
|
|
3341
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$1);
|
|
3299
3342
|
/**
|
|
3300
3343
|
* Sends an invitation email to an existing practitioner
|
|
3301
3344
|
* @param data The invitation email data
|
|
@@ -4466,6 +4509,81 @@ declare class Logger {
|
|
|
4466
4509
|
static debug(message: string, data?: any): void;
|
|
4467
4510
|
}
|
|
4468
4511
|
|
|
4512
|
+
/**
|
|
4513
|
+
* Minimal interface for the mailgun.js client if not importing full types
|
|
4514
|
+
*/
|
|
4515
|
+
interface NewMailgunMessagesAPI {
|
|
4516
|
+
create(domain: string, data: any): Promise<any>;
|
|
4517
|
+
}
|
|
4518
|
+
interface NewMailgunClient {
|
|
4519
|
+
messages: NewMailgunMessagesAPI;
|
|
4520
|
+
}
|
|
4521
|
+
/**
|
|
4522
|
+
* Interface for the data required to send a patient invitation email
|
|
4523
|
+
*/
|
|
4524
|
+
interface PatientInviteEmailData {
|
|
4525
|
+
/** The token object from the patient service */
|
|
4526
|
+
token: {
|
|
4527
|
+
id: string;
|
|
4528
|
+
token: string;
|
|
4529
|
+
patientId: string;
|
|
4530
|
+
email: string;
|
|
4531
|
+
clinicId: string;
|
|
4532
|
+
expiresAt: admin.firestore.Timestamp;
|
|
4533
|
+
};
|
|
4534
|
+
/** Patient basic info */
|
|
4535
|
+
patient: {
|
|
4536
|
+
firstName: string;
|
|
4537
|
+
lastName: string;
|
|
4538
|
+
};
|
|
4539
|
+
/** Clinic info */
|
|
4540
|
+
clinic: {
|
|
4541
|
+
name: string;
|
|
4542
|
+
contactEmail: string;
|
|
4543
|
+
contactName?: string;
|
|
4544
|
+
};
|
|
4545
|
+
/** Config options */
|
|
4546
|
+
options?: {
|
|
4547
|
+
registrationUrl?: string;
|
|
4548
|
+
customSubject?: string;
|
|
4549
|
+
fromAddress?: string;
|
|
4550
|
+
mailgunDomain?: string;
|
|
4551
|
+
};
|
|
4552
|
+
}
|
|
4553
|
+
/**
|
|
4554
|
+
* Service for sending patient invitation emails
|
|
4555
|
+
* Follows the same pattern as PractitionerInviteMailingService
|
|
4556
|
+
*/
|
|
4557
|
+
declare class PatientInviteMailingService extends BaseMailingService {
|
|
4558
|
+
private readonly DEFAULT_REGISTRATION_URL;
|
|
4559
|
+
private readonly DEFAULT_SUBJECT;
|
|
4560
|
+
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
4561
|
+
/**
|
|
4562
|
+
* Constructor for PatientInviteMailingService
|
|
4563
|
+
* @param firestore - Firestore instance provided by the caller
|
|
4564
|
+
* @param mailgunClient - Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
4565
|
+
*/
|
|
4566
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient);
|
|
4567
|
+
/**
|
|
4568
|
+
* Sends a patient invitation email
|
|
4569
|
+
* @param data - The patient invitation data
|
|
4570
|
+
* @returns Promise resolved when email is sent
|
|
4571
|
+
*/
|
|
4572
|
+
sendInvitationEmail(data: PatientInviteEmailData): Promise<any>;
|
|
4573
|
+
/**
|
|
4574
|
+
* Handles the patient token creation event from Cloud Functions.
|
|
4575
|
+
* Fetches necessary data and sends the invitation email.
|
|
4576
|
+
* @param tokenData - The fully typed token object including its id
|
|
4577
|
+
* @param mailgunConfig - Mailgun configuration (from, domain, optional registrationUrl)
|
|
4578
|
+
* @returns Promise resolved when the email is sent
|
|
4579
|
+
*/
|
|
4580
|
+
handleTokenCreationEvent(tokenData: PatientToken, mailgunConfig: {
|
|
4581
|
+
fromAddress: string;
|
|
4582
|
+
domain: string;
|
|
4583
|
+
registrationUrl?: string;
|
|
4584
|
+
}): Promise<void>;
|
|
4585
|
+
}
|
|
4586
|
+
|
|
4469
4587
|
interface AppointmentEmailDataBase {
|
|
4470
4588
|
appointment: Appointment;
|
|
4471
4589
|
options?: {
|
|
@@ -4507,7 +4625,7 @@ interface ReviewAddedEmailData extends AppointmentEmailDataBase {
|
|
|
4507
4625
|
*/
|
|
4508
4626
|
declare class AppointmentMailingService extends BaseMailingService {
|
|
4509
4627
|
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
4510
|
-
constructor(firestore: admin.firestore.Firestore, mailgunClient: NewMailgunClient$
|
|
4628
|
+
constructor(firestore: admin.firestore.Firestore, mailgunClient: NewMailgunClient$3);
|
|
4511
4629
|
/**
|
|
4512
4630
|
* Formats a Firestore Timestamp in the clinic's timezone
|
|
4513
4631
|
* @param timestamp - Firestore Timestamp (UTC)
|
|
@@ -4678,4 +4796,4 @@ declare class UserProfileAdminService {
|
|
|
4678
4796
|
initializePractitionerRole(userId: string): Promise<User>;
|
|
4679
4797
|
}
|
|
4680
4798
|
|
|
4681
|
-
export { ANALYTICS_COLLECTION, AnalyticsAdminService, type AnalyticsDateRange, type AnalyticsFilters, type AnalyticsMetadata, type AnalyticsPeriod, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AppointmentTrend, type AvailableSlot, BaseMailingService, type BaseMetrics, type BaseNotification, type BillingInfo, type BillingTransaction, BillingTransactionType, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CANCELLATION_ANALYTICS_SUBCOLLECTION, CLINICS_COLLECTION, CLINIC_ANALYTICS_SUBCOLLECTION, CalendarAdminService, type CancellationMetrics, type CancellationRateTrend, type CancellationReasonStats, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicAnalytics, type ClinicComparisonMetrics, type ClinicInfo, type ClinicLocation, type CostPerPatientMetrics, type CreateBillingTransactionData, DASHBOARD_ANALYTICS_SUBCOLLECTION, type DashboardAnalytics, type DoctorInfo, DocumentManagerAdminService, type DurationTrend, type EntityType, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type GroupedAnalyticsBase, type GroupedPatientBehaviorMetrics, type GroupedPatientRetentionMetrics, type GroupedPractitionerPerformanceMetrics, type GroupedProcedurePerformanceMetrics, type GroupedProductUsageMetrics, type GroupedRevenueMetrics, type GroupedTimeEfficiencyMetrics, type GroupingPeriod, type InitializeAppointmentFormsResult, Logger, NOTIFICATIONS_COLLECTION, NO_SHOW_ANALYTICS_SUBCOLLECTION, type NewMailgunClient$
|
|
4799
|
+
export { ANALYTICS_COLLECTION, AnalyticsAdminService, type AnalyticsDateRange, type AnalyticsFilters, type AnalyticsMetadata, type AnalyticsPeriod, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AppointmentTrend, type AvailableSlot, BaseMailingService, type BaseMetrics, type BaseNotification, type BillingInfo, type BillingTransaction, BillingTransactionType, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CANCELLATION_ANALYTICS_SUBCOLLECTION, CLINICS_COLLECTION, CLINIC_ANALYTICS_SUBCOLLECTION, CalendarAdminService, type CancellationMetrics, type CancellationRateTrend, type CancellationReasonStats, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicAnalytics, type ClinicComparisonMetrics, type ClinicInfo, type ClinicLocation, type CostPerPatientMetrics, type CreateBillingTransactionData, DASHBOARD_ANALYTICS_SUBCOLLECTION, type DashboardAnalytics, type DoctorInfo, DocumentManagerAdminService, type DurationTrend, type EntityType, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type GroupedAnalyticsBase, type GroupedPatientBehaviorMetrics, type GroupedPatientRetentionMetrics, type GroupedPractitionerPerformanceMetrics, type GroupedProcedurePerformanceMetrics, type GroupedProductUsageMetrics, type GroupedRevenueMetrics, type GroupedTimeEfficiencyMetrics, type GroupingPeriod, INVITE_TOKENS_COLLECTION, type InitializeAppointmentFormsResult, Logger, NOTIFICATIONS_COLLECTION, NO_SHOW_ANALYTICS_SUBCOLLECTION, type NewMailgunClient$3 as NewMailgunClient, type NoShowMetrics, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENTS_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONER_ANALYTICS_SUBCOLLECTION, PROCEDURE_ANALYTICS_SUBCOLLECTION, type PatientProfile as Patient, PatientAggregationService, type PatientAnalytics, PatientInstructionStatus, type PatientInviteEmailData, PatientInviteMailingService, type PatientLifetimeValueMetrics, type PatientProfile, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientRetentionMetrics, type PatientSensitiveInfo, type PatientToken, PatientTokenStatus, type PaymentStatusBreakdown, type PlanDetails, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, type PractitionerAnalytics, type PractitionerInvite, PractitionerInviteAggregationService, type PractitionerInviteEmailData, PractitionerInviteMailingService, PractitionerInviteStatus, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureAnalytics, type ProcedurePopularity, type ProcedureProfitability, type ProcedureSummaryInfo, type ProductRevenueMetrics, type ProductUsageByProcedure, type ProductUsageMetrics, REVENUE_ANALYTICS_SUBCOLLECTION, type ReadStoredAnalyticsOptions, type RequirementSourceProcedure, type RevenueMetrics, type RevenueTrend, type Review, type ReviewAddedEmailData, type ReviewMetrics, type ReviewRequestEmailData, type ReviewTrend, ReviewsAggregationService, type StoredCancellationMetrics, type StoredClinicAnalytics, type StoredDashboardAnalytics, type StoredNoShowMetrics, type StoredPractitionerAnalytics, type StoredProcedureAnalytics, type StoredRevenueMetrics, type StoredTimeEfficiencyMetrics, type StripeTransactionData, SubscriptionStatus, TIME_EFFICIENCY_ANALYTICS_SUBCOLLECTION, type TimeEfficiencyMetrics, type TimeInterval, type TrendPeriod, UserProfileAdminService, UserRole, freeConsultationInfrastructure };
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -2030,6 +2030,49 @@ interface PatientRequirementInstance {
|
|
|
2030
2030
|
*/
|
|
2031
2031
|
declare const PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
2032
2032
|
|
|
2033
|
+
declare const INVITE_TOKENS_COLLECTION = "inviteTokens";
|
|
2034
|
+
/**
|
|
2035
|
+
* @enum PatientTokenStatus
|
|
2036
|
+
* @description Represents the status of a patient registration token.
|
|
2037
|
+
* @property {string} ACTIVE - The token is active and can be used for registration.
|
|
2038
|
+
* @property {string} USED - The token has been used and is no longer valid.
|
|
2039
|
+
* @property {string} EXPIRED - The token has expired and is no longer valid.
|
|
2040
|
+
*/
|
|
2041
|
+
declare enum PatientTokenStatus {
|
|
2042
|
+
ACTIVE = "active",
|
|
2043
|
+
USED = "used",
|
|
2044
|
+
EXPIRED = "expired"
|
|
2045
|
+
}
|
|
2046
|
+
/**
|
|
2047
|
+
* @interface PatientToken
|
|
2048
|
+
* @description Represents a registration token for a patient to claim their profile.
|
|
2049
|
+
* These tokens are stored in a subcollection under the patient's profile.
|
|
2050
|
+
* @property {string} id - The unique identifier for the token document.
|
|
2051
|
+
* @property {string} token - The unique token string (e.g., a 6-character code).
|
|
2052
|
+
* @property {string} patientId - The ID of the patient profile this token is for.
|
|
2053
|
+
* @property {string} email - The email address the invitation was sent to.
|
|
2054
|
+
* @property {string} clinicId - The ID of the clinic that created the invitation.
|
|
2055
|
+
* @property {PatientTokenStatus} status - The current status of the token.
|
|
2056
|
+
* @property {string} createdBy - The ID of the admin user who created the token.
|
|
2057
|
+
* @property {Timestamp} createdAt - The timestamp when the token was created.
|
|
2058
|
+
* @property {Timestamp} expiresAt - The timestamp when the token expires.
|
|
2059
|
+
* @property {string} [usedBy] - The ID of the user who used the token (optional).
|
|
2060
|
+
* @property {Timestamp} [usedAt] - The timestamp when the token was used (optional).
|
|
2061
|
+
*/
|
|
2062
|
+
interface PatientToken {
|
|
2063
|
+
id: string;
|
|
2064
|
+
token: string;
|
|
2065
|
+
patientId: string;
|
|
2066
|
+
email: string;
|
|
2067
|
+
clinicId: string;
|
|
2068
|
+
status: PatientTokenStatus;
|
|
2069
|
+
createdBy: string;
|
|
2070
|
+
createdAt: Timestamp;
|
|
2071
|
+
expiresAt: Timestamp;
|
|
2072
|
+
usedBy?: string;
|
|
2073
|
+
usedAt?: Timestamp;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2033
2076
|
/**
|
|
2034
2077
|
* Base metrics interface with common properties
|
|
2035
2078
|
*/
|
|
@@ -3085,11 +3128,11 @@ type Notification = PreRequirementNotification | PostRequirementNotification | R
|
|
|
3085
3128
|
* This helps avoid a direct dependency on mailgun.js in the API package if not desired,
|
|
3086
3129
|
* or provides clearer typing if it is.
|
|
3087
3130
|
*/
|
|
3088
|
-
interface NewMailgunMessagesAPI$
|
|
3131
|
+
interface NewMailgunMessagesAPI$3 {
|
|
3089
3132
|
create(domain: string, data: any): Promise<any>;
|
|
3090
3133
|
}
|
|
3091
|
-
interface NewMailgunClient$
|
|
3092
|
-
messages: NewMailgunMessagesAPI$
|
|
3134
|
+
interface NewMailgunClient$3 {
|
|
3135
|
+
messages: NewMailgunMessagesAPI$3;
|
|
3093
3136
|
}
|
|
3094
3137
|
/**
|
|
3095
3138
|
* Base mailing service class that provides common functionality for all mailing services
|
|
@@ -3097,13 +3140,13 @@ interface NewMailgunClient$2 {
|
|
|
3097
3140
|
*/
|
|
3098
3141
|
declare class BaseMailingService {
|
|
3099
3142
|
protected db: FirebaseFirestore.Firestore;
|
|
3100
|
-
protected mailgunClient: NewMailgunClient$
|
|
3143
|
+
protected mailgunClient: NewMailgunClient$3;
|
|
3101
3144
|
/**
|
|
3102
3145
|
* Constructor for BaseMailingService
|
|
3103
3146
|
* @param firestore Firestore instance provided by the caller
|
|
3104
3147
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
3105
3148
|
*/
|
|
3106
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$
|
|
3149
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$3);
|
|
3107
3150
|
/**
|
|
3108
3151
|
* Sends an email using the new Mailgun client API.
|
|
3109
3152
|
* @param domain The Mailgun domain to send from (e.g., mg.metaesthetics.net)
|
|
@@ -3132,11 +3175,11 @@ declare class BaseMailingService {
|
|
|
3132
3175
|
protected renderTemplate(template: string, variables: Record<string, string>): string;
|
|
3133
3176
|
}
|
|
3134
3177
|
|
|
3135
|
-
interface NewMailgunMessagesAPI$
|
|
3178
|
+
interface NewMailgunMessagesAPI$2 {
|
|
3136
3179
|
create(domain: string, data: any): Promise<any>;
|
|
3137
3180
|
}
|
|
3138
|
-
interface NewMailgunClient$
|
|
3139
|
-
messages: NewMailgunMessagesAPI$
|
|
3181
|
+
interface NewMailgunClient$2 {
|
|
3182
|
+
messages: NewMailgunMessagesAPI$2;
|
|
3140
3183
|
}
|
|
3141
3184
|
/**
|
|
3142
3185
|
* Interface for the data required to send a practitioner invitation email
|
|
@@ -3182,7 +3225,7 @@ declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
|
3182
3225
|
* @param firestore Firestore instance provided by the caller
|
|
3183
3226
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
3184
3227
|
*/
|
|
3185
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$
|
|
3228
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$2);
|
|
3186
3229
|
/**
|
|
3187
3230
|
* Sends a practitioner invitation email
|
|
3188
3231
|
* @param data The practitioner invitation data
|
|
@@ -3205,11 +3248,11 @@ declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
|
3205
3248
|
}): Promise<void>;
|
|
3206
3249
|
}
|
|
3207
3250
|
|
|
3208
|
-
interface NewMailgunMessagesAPI {
|
|
3251
|
+
interface NewMailgunMessagesAPI$1 {
|
|
3209
3252
|
create(domain: string, data: any): Promise<any>;
|
|
3210
3253
|
}
|
|
3211
|
-
interface NewMailgunClient {
|
|
3212
|
-
messages: NewMailgunMessagesAPI;
|
|
3254
|
+
interface NewMailgunClient$1 {
|
|
3255
|
+
messages: NewMailgunMessagesAPI$1;
|
|
3213
3256
|
}
|
|
3214
3257
|
/**
|
|
3215
3258
|
* Interface for sending practitioner invitation email data
|
|
@@ -3295,7 +3338,7 @@ declare class ExistingPractitionerInviteMailingService extends BaseMailingServic
|
|
|
3295
3338
|
* @param firestore Firestore instance provided by the caller
|
|
3296
3339
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
3297
3340
|
*/
|
|
3298
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient);
|
|
3341
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$1);
|
|
3299
3342
|
/**
|
|
3300
3343
|
* Sends an invitation email to an existing practitioner
|
|
3301
3344
|
* @param data The invitation email data
|
|
@@ -4466,6 +4509,81 @@ declare class Logger {
|
|
|
4466
4509
|
static debug(message: string, data?: any): void;
|
|
4467
4510
|
}
|
|
4468
4511
|
|
|
4512
|
+
/**
|
|
4513
|
+
* Minimal interface for the mailgun.js client if not importing full types
|
|
4514
|
+
*/
|
|
4515
|
+
interface NewMailgunMessagesAPI {
|
|
4516
|
+
create(domain: string, data: any): Promise<any>;
|
|
4517
|
+
}
|
|
4518
|
+
interface NewMailgunClient {
|
|
4519
|
+
messages: NewMailgunMessagesAPI;
|
|
4520
|
+
}
|
|
4521
|
+
/**
|
|
4522
|
+
* Interface for the data required to send a patient invitation email
|
|
4523
|
+
*/
|
|
4524
|
+
interface PatientInviteEmailData {
|
|
4525
|
+
/** The token object from the patient service */
|
|
4526
|
+
token: {
|
|
4527
|
+
id: string;
|
|
4528
|
+
token: string;
|
|
4529
|
+
patientId: string;
|
|
4530
|
+
email: string;
|
|
4531
|
+
clinicId: string;
|
|
4532
|
+
expiresAt: admin.firestore.Timestamp;
|
|
4533
|
+
};
|
|
4534
|
+
/** Patient basic info */
|
|
4535
|
+
patient: {
|
|
4536
|
+
firstName: string;
|
|
4537
|
+
lastName: string;
|
|
4538
|
+
};
|
|
4539
|
+
/** Clinic info */
|
|
4540
|
+
clinic: {
|
|
4541
|
+
name: string;
|
|
4542
|
+
contactEmail: string;
|
|
4543
|
+
contactName?: string;
|
|
4544
|
+
};
|
|
4545
|
+
/** Config options */
|
|
4546
|
+
options?: {
|
|
4547
|
+
registrationUrl?: string;
|
|
4548
|
+
customSubject?: string;
|
|
4549
|
+
fromAddress?: string;
|
|
4550
|
+
mailgunDomain?: string;
|
|
4551
|
+
};
|
|
4552
|
+
}
|
|
4553
|
+
/**
|
|
4554
|
+
* Service for sending patient invitation emails
|
|
4555
|
+
* Follows the same pattern as PractitionerInviteMailingService
|
|
4556
|
+
*/
|
|
4557
|
+
declare class PatientInviteMailingService extends BaseMailingService {
|
|
4558
|
+
private readonly DEFAULT_REGISTRATION_URL;
|
|
4559
|
+
private readonly DEFAULT_SUBJECT;
|
|
4560
|
+
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
4561
|
+
/**
|
|
4562
|
+
* Constructor for PatientInviteMailingService
|
|
4563
|
+
* @param firestore - Firestore instance provided by the caller
|
|
4564
|
+
* @param mailgunClient - Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
4565
|
+
*/
|
|
4566
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient);
|
|
4567
|
+
/**
|
|
4568
|
+
* Sends a patient invitation email
|
|
4569
|
+
* @param data - The patient invitation data
|
|
4570
|
+
* @returns Promise resolved when email is sent
|
|
4571
|
+
*/
|
|
4572
|
+
sendInvitationEmail(data: PatientInviteEmailData): Promise<any>;
|
|
4573
|
+
/**
|
|
4574
|
+
* Handles the patient token creation event from Cloud Functions.
|
|
4575
|
+
* Fetches necessary data and sends the invitation email.
|
|
4576
|
+
* @param tokenData - The fully typed token object including its id
|
|
4577
|
+
* @param mailgunConfig - Mailgun configuration (from, domain, optional registrationUrl)
|
|
4578
|
+
* @returns Promise resolved when the email is sent
|
|
4579
|
+
*/
|
|
4580
|
+
handleTokenCreationEvent(tokenData: PatientToken, mailgunConfig: {
|
|
4581
|
+
fromAddress: string;
|
|
4582
|
+
domain: string;
|
|
4583
|
+
registrationUrl?: string;
|
|
4584
|
+
}): Promise<void>;
|
|
4585
|
+
}
|
|
4586
|
+
|
|
4469
4587
|
interface AppointmentEmailDataBase {
|
|
4470
4588
|
appointment: Appointment;
|
|
4471
4589
|
options?: {
|
|
@@ -4507,7 +4625,7 @@ interface ReviewAddedEmailData extends AppointmentEmailDataBase {
|
|
|
4507
4625
|
*/
|
|
4508
4626
|
declare class AppointmentMailingService extends BaseMailingService {
|
|
4509
4627
|
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
4510
|
-
constructor(firestore: admin.firestore.Firestore, mailgunClient: NewMailgunClient$
|
|
4628
|
+
constructor(firestore: admin.firestore.Firestore, mailgunClient: NewMailgunClient$3);
|
|
4511
4629
|
/**
|
|
4512
4630
|
* Formats a Firestore Timestamp in the clinic's timezone
|
|
4513
4631
|
* @param timestamp - Firestore Timestamp (UTC)
|
|
@@ -4678,4 +4796,4 @@ declare class UserProfileAdminService {
|
|
|
4678
4796
|
initializePractitionerRole(userId: string): Promise<User>;
|
|
4679
4797
|
}
|
|
4680
4798
|
|
|
4681
|
-
export { ANALYTICS_COLLECTION, AnalyticsAdminService, type AnalyticsDateRange, type AnalyticsFilters, type AnalyticsMetadata, type AnalyticsPeriod, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AppointmentTrend, type AvailableSlot, BaseMailingService, type BaseMetrics, type BaseNotification, type BillingInfo, type BillingTransaction, BillingTransactionType, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CANCELLATION_ANALYTICS_SUBCOLLECTION, CLINICS_COLLECTION, CLINIC_ANALYTICS_SUBCOLLECTION, CalendarAdminService, type CancellationMetrics, type CancellationRateTrend, type CancellationReasonStats, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicAnalytics, type ClinicComparisonMetrics, type ClinicInfo, type ClinicLocation, type CostPerPatientMetrics, type CreateBillingTransactionData, DASHBOARD_ANALYTICS_SUBCOLLECTION, type DashboardAnalytics, type DoctorInfo, DocumentManagerAdminService, type DurationTrend, type EntityType, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type GroupedAnalyticsBase, type GroupedPatientBehaviorMetrics, type GroupedPatientRetentionMetrics, type GroupedPractitionerPerformanceMetrics, type GroupedProcedurePerformanceMetrics, type GroupedProductUsageMetrics, type GroupedRevenueMetrics, type GroupedTimeEfficiencyMetrics, type GroupingPeriod, type InitializeAppointmentFormsResult, Logger, NOTIFICATIONS_COLLECTION, NO_SHOW_ANALYTICS_SUBCOLLECTION, type NewMailgunClient$
|
|
4799
|
+
export { ANALYTICS_COLLECTION, AnalyticsAdminService, type AnalyticsDateRange, type AnalyticsFilters, type AnalyticsMetadata, type AnalyticsPeriod, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AppointmentTrend, type AvailableSlot, BaseMailingService, type BaseMetrics, type BaseNotification, type BillingInfo, type BillingTransaction, BillingTransactionType, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CANCELLATION_ANALYTICS_SUBCOLLECTION, CLINICS_COLLECTION, CLINIC_ANALYTICS_SUBCOLLECTION, CalendarAdminService, type CancellationMetrics, type CancellationRateTrend, type CancellationReasonStats, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicAnalytics, type ClinicComparisonMetrics, type ClinicInfo, type ClinicLocation, type CostPerPatientMetrics, type CreateBillingTransactionData, DASHBOARD_ANALYTICS_SUBCOLLECTION, type DashboardAnalytics, type DoctorInfo, DocumentManagerAdminService, type DurationTrend, type EntityType, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type GroupedAnalyticsBase, type GroupedPatientBehaviorMetrics, type GroupedPatientRetentionMetrics, type GroupedPractitionerPerformanceMetrics, type GroupedProcedurePerformanceMetrics, type GroupedProductUsageMetrics, type GroupedRevenueMetrics, type GroupedTimeEfficiencyMetrics, type GroupingPeriod, INVITE_TOKENS_COLLECTION, type InitializeAppointmentFormsResult, Logger, NOTIFICATIONS_COLLECTION, NO_SHOW_ANALYTICS_SUBCOLLECTION, type NewMailgunClient$3 as NewMailgunClient, type NoShowMetrics, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENTS_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONER_ANALYTICS_SUBCOLLECTION, PROCEDURE_ANALYTICS_SUBCOLLECTION, type PatientProfile as Patient, PatientAggregationService, type PatientAnalytics, PatientInstructionStatus, type PatientInviteEmailData, PatientInviteMailingService, type PatientLifetimeValueMetrics, type PatientProfile, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientRetentionMetrics, type PatientSensitiveInfo, type PatientToken, PatientTokenStatus, type PaymentStatusBreakdown, type PlanDetails, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, type PractitionerAnalytics, type PractitionerInvite, PractitionerInviteAggregationService, type PractitionerInviteEmailData, PractitionerInviteMailingService, PractitionerInviteStatus, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureAnalytics, type ProcedurePopularity, type ProcedureProfitability, type ProcedureSummaryInfo, type ProductRevenueMetrics, type ProductUsageByProcedure, type ProductUsageMetrics, REVENUE_ANALYTICS_SUBCOLLECTION, type ReadStoredAnalyticsOptions, type RequirementSourceProcedure, type RevenueMetrics, type RevenueTrend, type Review, type ReviewAddedEmailData, type ReviewMetrics, type ReviewRequestEmailData, type ReviewTrend, ReviewsAggregationService, type StoredCancellationMetrics, type StoredClinicAnalytics, type StoredDashboardAnalytics, type StoredNoShowMetrics, type StoredPractitionerAnalytics, type StoredProcedureAnalytics, type StoredRevenueMetrics, type StoredTimeEfficiencyMetrics, type StripeTransactionData, SubscriptionStatus, TIME_EFFICIENCY_ANALYTICS_SUBCOLLECTION, type TimeEfficiencyMetrics, type TimeInterval, type TrendPeriod, UserProfileAdminService, UserRole, freeConsultationInfrastructure };
|