@blackcode_sa/metaestetics-api 1.15.8 → 1.15.10

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.
@@ -1138,9 +1138,15 @@ interface AdminInfo {
1138
1138
  */
1139
1139
  declare enum SubscriptionModel {
1140
1140
  NO_SUBSCRIPTION = "no_subscription",
1141
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
1141
1142
  BASIC = "basic",
1143
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
1142
1144
  PREMIUM = "premium",
1143
- ENTERPRISE = "enterprise"
1145
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
1146
+ ENTERPRISE = "enterprise",
1147
+ FREE = "free",
1148
+ CONNECT = "connect",
1149
+ PRO = "pro"
1144
1150
  }
1145
1151
  /**
1146
1152
  * Enum for subscription status
@@ -1165,6 +1171,8 @@ interface BillingInfo {
1165
1171
  currentPeriodStart: Timestamp | null;
1166
1172
  currentPeriodEnd: Timestamp | null;
1167
1173
  updatedAt: Timestamp;
1174
+ seatCount?: number;
1175
+ seatPriceId?: string;
1168
1176
  }
1169
1177
  /**
1170
1178
  * Enum for billing transaction types
@@ -1255,6 +1263,12 @@ interface ClinicGroup {
1255
1263
  completed?: boolean;
1256
1264
  step?: number;
1257
1265
  };
1266
+ featureTrials?: {
1267
+ analytics?: {
1268
+ startedAt: Timestamp;
1269
+ durationDays: number;
1270
+ };
1271
+ };
1258
1272
  }
1259
1273
  /**
1260
1274
  * Interface for doctor information
@@ -1297,6 +1311,7 @@ interface Clinic {
1297
1311
  isActive: boolean;
1298
1312
  isVerified: boolean;
1299
1313
  logo?: MediaResource | null;
1314
+ acceptingBookings?: boolean;
1300
1315
  }
1301
1316
 
1302
1317
  /**
@@ -1138,9 +1138,15 @@ interface AdminInfo {
1138
1138
  */
1139
1139
  declare enum SubscriptionModel {
1140
1140
  NO_SUBSCRIPTION = "no_subscription",
1141
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
1141
1142
  BASIC = "basic",
1143
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
1142
1144
  PREMIUM = "premium",
1143
- ENTERPRISE = "enterprise"
1145
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
1146
+ ENTERPRISE = "enterprise",
1147
+ FREE = "free",
1148
+ CONNECT = "connect",
1149
+ PRO = "pro"
1144
1150
  }
1145
1151
  /**
1146
1152
  * Enum for subscription status
@@ -1165,6 +1171,8 @@ interface BillingInfo {
1165
1171
  currentPeriodStart: Timestamp | null;
1166
1172
  currentPeriodEnd: Timestamp | null;
1167
1173
  updatedAt: Timestamp;
1174
+ seatCount?: number;
1175
+ seatPriceId?: string;
1168
1176
  }
1169
1177
  /**
1170
1178
  * Enum for billing transaction types
@@ -1255,6 +1263,12 @@ interface ClinicGroup {
1255
1263
  completed?: boolean;
1256
1264
  step?: number;
1257
1265
  };
1266
+ featureTrials?: {
1267
+ analytics?: {
1268
+ startedAt: Timestamp;
1269
+ durationDays: number;
1270
+ };
1271
+ };
1258
1272
  }
1259
1273
  /**
1260
1274
  * Interface for doctor information
@@ -1297,6 +1311,7 @@ interface Clinic {
1297
1311
  isActive: boolean;
1298
1312
  isVerified: boolean;
1299
1313
  logo?: MediaResource | null;
1314
+ acceptingBookings?: boolean;
1300
1315
  }
1301
1316
 
1302
1317
  /**
package/dist/index.d.mts CHANGED
@@ -5308,6 +5308,64 @@ interface ProcedureSummaryInfo {
5308
5308
  practitionerName: string;
5309
5309
  }
5310
5310
 
5311
+ /**
5312
+ * RBAC (Role-Based Access Control) types for clinic staff management
5313
+ */
5314
+ /**
5315
+ * Roles that can be assigned to clinic staff members
5316
+ */
5317
+ declare enum ClinicRole {
5318
+ OWNER = "owner",
5319
+ ADMIN = "admin",
5320
+ DOCTOR = "doctor",
5321
+ RECEPTIONIST = "receptionist",
5322
+ ASSISTANT = "assistant"
5323
+ }
5324
+ /**
5325
+ * Represents a staff member within a clinic group
5326
+ */
5327
+ interface ClinicStaffMember {
5328
+ id?: string;
5329
+ userId: string;
5330
+ clinicGroupId: string;
5331
+ clinicId?: string;
5332
+ role: ClinicRole;
5333
+ permissions: Record<string, boolean>;
5334
+ isActive: boolean;
5335
+ createdAt?: any;
5336
+ updatedAt?: any;
5337
+ }
5338
+ /**
5339
+ * Configuration for default permissions assigned to a role
5340
+ */
5341
+ interface RolePermissionConfig {
5342
+ clinicGroupId?: string;
5343
+ role: ClinicRole;
5344
+ permissions: Record<string, boolean>;
5345
+ }
5346
+ /**
5347
+ * Usage limits for a given subscription tier.
5348
+ * All features are available on every tier — only usage is capped.
5349
+ * -1 means unlimited.
5350
+ */
5351
+ interface TierLimits {
5352
+ maxProviders: number;
5353
+ maxProcedures: number;
5354
+ maxAppointmentsPerMonth: number;
5355
+ maxMessagesPerMonth: number;
5356
+ maxStaff: number;
5357
+ maxBranches: number;
5358
+ }
5359
+ /**
5360
+ * Configuration for a subscription tier.
5361
+ * Every tier has access to all features — tiers differ only in usage limits.
5362
+ */
5363
+ interface TierConfig {
5364
+ tier: string;
5365
+ name: string;
5366
+ limits: TierLimits;
5367
+ }
5368
+
5311
5369
  declare const CLINIC_GROUPS_COLLECTION = "clinic_groups";
5312
5370
  declare const CLINIC_ADMINS_COLLECTION = "clinic_admins";
5313
5371
  declare const CLINICS_COLLECTION = "clinics";
@@ -5461,9 +5519,15 @@ interface AdminInfo {
5461
5519
  */
5462
5520
  declare enum SubscriptionModel {
5463
5521
  NO_SUBSCRIPTION = "no_subscription",
5522
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
5464
5523
  BASIC = "basic",
5524
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
5465
5525
  PREMIUM = "premium",
5466
- ENTERPRISE = "enterprise"
5526
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
5527
+ ENTERPRISE = "enterprise",
5528
+ FREE = "free",
5529
+ CONNECT = "connect",
5530
+ PRO = "pro"
5467
5531
  }
5468
5532
  /**
5469
5533
  * Enum for subscription status
@@ -5488,6 +5552,8 @@ interface BillingInfo {
5488
5552
  currentPeriodStart: Timestamp | null;
5489
5553
  currentPeriodEnd: Timestamp | null;
5490
5554
  updatedAt: Timestamp;
5555
+ seatCount?: number;
5556
+ seatPriceId?: string;
5491
5557
  }
5492
5558
  /**
5493
5559
  * Enum for billing transaction types
@@ -5578,6 +5644,12 @@ interface ClinicGroup {
5578
5644
  completed?: boolean;
5579
5645
  step?: number;
5580
5646
  };
5647
+ featureTrials?: {
5648
+ analytics?: {
5649
+ startedAt: Timestamp;
5650
+ durationDays: number;
5651
+ };
5652
+ };
5581
5653
  }
5582
5654
  /**
5583
5655
  * Interface for creating a clinic group
@@ -5658,6 +5730,7 @@ interface Clinic {
5658
5730
  isActive: boolean;
5659
5731
  isVerified: boolean;
5660
5732
  logo?: MediaResource | null;
5733
+ acceptingBookings?: boolean;
5661
5734
  }
5662
5735
  /**
5663
5736
  * Interface for creating a clinic
@@ -9665,6 +9738,48 @@ declare class ReviewService extends BaseService {
9665
9738
  private calculateAverage;
9666
9739
  }
9667
9740
 
9741
+ declare class TierLimitError extends Error {
9742
+ readonly code = "TIER_LIMIT_EXCEEDED";
9743
+ readonly currentTier: string;
9744
+ readonly resource: string;
9745
+ readonly currentCount: number;
9746
+ readonly maxAllowed: number;
9747
+ constructor(resource: string, currentTier: string, currentCount: number, maxAllowed: number);
9748
+ }
9749
+ /**
9750
+ * Fetches the effective tier for a clinic group.
9751
+ * Returns the resolved tier string (e.g., 'free', 'connect', 'pro').
9752
+ */
9753
+ declare function getEffectiveTier(db: Firestore, clinicGroupId: string): Promise<string>;
9754
+ /**
9755
+ * Enforces tier limit before adding a provider (practitioner/doctor/nurse/etc.).
9756
+ * Throws TierLimitError if the limit would be exceeded.
9757
+ */
9758
+ declare function enforceProviderLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9759
+ /**
9760
+ * Enforces tier limit before creating a procedure.
9761
+ * @param count - Number of procedures being created (default 1, higher for bulk)
9762
+ */
9763
+ declare function enforceProcedureLimit(db: Firestore, clinicGroupId: string, count?: number): Promise<void>;
9764
+ /**
9765
+ * Enforces tier limit before creating a clinic branch.
9766
+ */
9767
+ declare function enforceBranchLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9768
+ /**
9769
+ * Enforces tier limit before creating a staff member.
9770
+ */
9771
+ declare function enforceStaffLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9772
+ /**
9773
+ * Enforces tier limit before creating an appointment.
9774
+ * Reads the monthly counter from clinic_groups/{id}/usage_counters/{YYYY-MM}.
9775
+ */
9776
+ declare function enforceAppointmentLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9777
+ /**
9778
+ * Enforces tier limit before sending a message.
9779
+ * Reads the monthly counter from clinic_groups/{id}/usage_counters/{YYYY-MM}.
9780
+ */
9781
+ declare function enforceMessageLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9782
+
9668
9783
  interface FirebaseInstance {
9669
9784
  app: FirebaseApp;
9670
9785
  db: Firestore;
@@ -9689,4 +9804,53 @@ declare const getFirebaseApp: () => Promise<FirebaseApp>;
9689
9804
  declare const getFirebaseStorage: () => Promise<FirebaseStorage>;
9690
9805
  declare const getFirebaseFunctions: () => Promise<Functions>;
9691
9806
 
9692
- export { AESTHETIC_ANALYSIS_COLLECTION, ANALYTICS_COLLECTION, APPOINTMENTS_COLLECTION, type ASAClassification, AcquisitionSource, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type AestheticAnalysis, type AestheticAnalysisStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, AnalyticsCloudService, type AnalyticsDateRange, type AnalyticsFilters, type AnalyticsMetadata, type AnalyticsPeriod, AnalyticsService, type AnesthesiaHistory, type Appointment, type AppointmentCancelledNotification, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentProductMetadata, type AppointmentReminderNotification, type AppointmentRescheduledProposalNotification, type AppointmentRescheduledReminderNotification, AppointmentService, AppointmentStatus, type AppointmentStatusChangeNotification, type AppointmentTrend, type AssessmentScales, AuthService, BODY_ASSESSMENT_COLLECTION, type BaseDocumentElement, type BaseMetrics, type BaseNotification, BaseService, type BeforeAfterPerZone, type BillingInfo, type BillingPerZone, type BillingTransaction, BillingTransactionType, BillingTransactionsService, type BinaryChoiceElement, type BleedingRisk, type BleedingRiskLevel, BlockingCondition, type BodyAssessment, type BodyAssessmentStatus, type BodyCompositionData, type BodyMeasurementsData, type BodySymmetryData, type BodyZone, type BodyZoneAssessment, type Brand, BrandService, type Break, CALENDAR_COLLECTION, CANCELLATION_ANALYTICS_SUBCOLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_ANALYTICS_SUBCOLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarServiceV3, CalendarSyncStatus, type CancellationMetrics, type CancellationRateTrend, type CancellationReasonStats, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type ClearanceStatus, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicAnalytics, type ClinicBranchSetupData, type ClinicComparisonMetrics, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ClinicalFindingDetail, type ClinicalFindings, ConstantsService, type ContactPerson, Contraindication, type ContraindicationDynamic, CosmeticAllergySubtype, type CostPerPatientMetrics, type CreateAdminTokenData, type CreateAestheticAnalysisData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateBillingTransactionData, type CreateBlockingEventParams, type CreateBodyAssessmentData, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreateHairScalpAssessmentData, type CreateManualPatientData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePatientTokenData, type CreatePractitionerData, type CreatePractitionerInviteData, type CreatePractitionerTokenData, type CreatePreSurgicalAssessmentData, type CreateProcedureData, type CreateSkinQualityAssessmentData, type CreateSyncedCalendarData, type CreateUserData, Currency, DASHBOARD_ANALYTICS_SUBCOLLECTION, DEFAULT_MEDICAL_INFO, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DashboardAnalytics, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DurationTrend, type DynamicTextElement, DynamicVariable, type ElastosisGrade, type EmergencyContact, type EntityType, EnvironmentalAllergySubtype, type ExtendedProcedureInfo, ExternalCalendarService, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, type FinalBilling, type FirebaseUser, type FitzpatrickType, FoodAllergySubtype, type FormReminderNotification, type FormSubmissionConfirmationNotification, type GamificationInfo, Gender, type GeneralMessageNotification, type GlogauClassification, type GroupedAnalyticsBase, type GroupedPatientBehaviorMetrics, type GroupedPatientRetentionMetrics, type GroupedPractitionerPerformanceMetrics, type GroupedProcedurePerformanceMetrics, type GroupedProductUsageMetrics, type GroupedRevenueMetrics, type GroupedTimeEfficiencyMetrics, type GroupingPeriod, HAIR_SCALP_ASSESSMENT_COLLECTION, type HairCharacteristics, type HairColor, type HairDensity, type HairLossPattern, type HairLossType, type HairLossZone, type HairLossZoneAssessment, type HairScalpAssessment, type HairScalpAssessmentStatus, type HairTextureGrade, type HairType, type HeadingElement, HeadingLevel, INVITE_TOKENS_COLLECTION, type LabResult, Language, type LinkedFormInfo, type ListElement, ListType, type LocationData, type LudwigStage, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MediaType, MedicationAllergySubtype, type MultipleChoiceElement, type MuscleDefinitionLevel, NOTIFICATIONS_COLLECTION, NO_SHOW_ANALYTICS_SUBCOLLECTION, type NextStepsRecommendation, type NoShowMetrics, type NorwoodStage, type Notification, NotificationService, NotificationStatus, NotificationType, type OverallReviewAverages, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PRACTITIONER_ANALYTICS_SUBCOLLECTION, PRACTITIONER_INVITES_COLLECTION, PRE_SURGICAL_ASSESSMENT_COLLECTION, PROCEDURES_COLLECTION, PROCEDURE_ANALYTICS_SUBCOLLECTION, type ParagraphElement, type PatientAnalytics, type PatientClinic, type PatientDoctor, type PatientGoals, PatientInstructionStatus, type PatientLifetimeValueMetrics, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileForDoctor, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, type PatientRequirementsFilters, PatientRequirementsService, type PatientRetentionMetrics, type PatientReviewInfo, type PatientSensitiveInfo, PatientService, type PatientToken, PatientTokenStatus, type PaymentConfirmationNotification, PaymentStatus, type PaymentStatusBreakdown, type PlanDetails, type PoreSizeLevel, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerAnalytics, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerInvite, type PractitionerInviteFilters, PractitionerInviteService, PractitionerInviteStatus, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, type PreSurgicalAssessment, type PreSurgicalAssessmentStatus, PricingMeasure, type Procedure, type ProcedureAnalytics, type ProcedureCategorization, type ProcedureExtendedInfo, ProcedureFamily, type ProcedureInfo, type ProcedurePopularity, type ProcedureProduct, type ProcedureProfitability, type ProcedureRecommendationNotification, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type ProcedureSummaryInfo, type Product, type ProductRevenueMetrics, ProductService, type ProductUsageByProcedure, type ProductUsageMetrics, type ProposedWorkingHours, REGISTER_TOKENS_COLLECTION, REVENUE_ANALYTICS_SUBCOLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type ReadStoredAnalyticsOptions, type RecommendedProcedure, type RequesterInfo, type Requirement, type RequirementInstructionDueNotification, type RequirementSourceProcedure, RequirementType, type RevenueMetrics, type RevenueTrend, type Review, type ReviewAnalyticsMetrics, ReviewAnalyticsService, type ReviewDetail, type ReviewMetrics, type ReviewRequestNotification, ReviewService, type ReviewTrend, SKIN_QUALITY_ASSESSMENT_COLLECTION, SYNCED_CALENDARS_COLLECTION, type ScalpCondition, type ScalpRednessLevel, type ScalpScalinessLevel, type ScalpSebumLevel, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SeverityLevel, type SignatureElement, type SingleChoiceElement, type SkinCharacteristics, type SkinConditionEntry, type SkinConditionType, type SkinElasticityLevel, type SkinHydrationLevel, type SkinQualityAssessment, type SkinQualityAssessmentStatus, type SkinQualityScales, type SkinSensitivityLevel, type SkinTextureLevel, type SkinZone, type SkinZoneAssessment, type SmokingStatus, type StoredCancellationMetrics, type StoredClinicAnalytics, type StoredDashboardAnalytics, type StoredNoShowMetrics, type StoredPractitionerAnalytics, type StoredProcedureAnalytics, type StoredRevenueMetrics, type StoredTimeEfficiencyMetrics, type StripeTransactionData, type Subcategory, SubcategoryService, SubscriptionModel, SubscriptionStatus, type SurgicalSiteAssessment, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, TIME_EFFICIENCY_ANALYTICS_SUBCOLLECTION, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeEfficiencyMetrics, type TimeSlot, TimeUnit, type TissueQualityLevel, TreatmentBenefit, type TreatmentBenefitDynamic, type TrendPeriod, USERS_COLLECTION, USER_FORMS_SUBCOLLECTION, type UpdateAestheticAnalysisData, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateBlockingEventParams, type UpdateBodyAssessmentData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateHairScalpAssessmentData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdatePractitionerInviteData, type UpdatePreSurgicalAssessmentData, type UpdateProcedureData, type UpdateSkinQualityAssessmentData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type VitalStats, type WorkingHours, type ZoneItemData, type ZonePhotoUploadData, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseFunctions, getFirebaseInstance, getFirebaseStorage, initializeFirebase };
9807
+ /**
9808
+ * Permission keys used for role-based access control.
9809
+ * Every feature is available on every tier — these only control
9810
+ * what a given role (owner/admin/doctor/etc.) can do.
9811
+ */
9812
+ declare const PERMISSION_KEYS: {
9813
+ readonly 'clinic.view': true;
9814
+ readonly 'clinic.edit': true;
9815
+ readonly 'reviews.view': true;
9816
+ readonly 'calendar.view': true;
9817
+ readonly 'appointments.view': true;
9818
+ readonly 'appointments.confirm': true;
9819
+ readonly 'appointments.cancel': true;
9820
+ readonly messaging: true;
9821
+ readonly 'procedures.view': true;
9822
+ readonly 'procedures.create': true;
9823
+ readonly 'procedures.edit': true;
9824
+ readonly 'procedures.delete': true;
9825
+ readonly 'patients.view': true;
9826
+ readonly 'patients.edit': true;
9827
+ readonly 'providers.view': true;
9828
+ readonly 'providers.manage': true;
9829
+ readonly 'analytics.view': true;
9830
+ readonly 'staff.manage': true;
9831
+ readonly 'settings.manage': true;
9832
+ readonly 'billing.manage': true;
9833
+ };
9834
+ type PermissionKey = keyof typeof PERMISSION_KEYS;
9835
+ /**
9836
+ * Usage limits per subscription tier.
9837
+ * All features are available on every tier — tiers differ only in usage caps.
9838
+ * -1 means unlimited.
9839
+ *
9840
+ * Confirmed by client on 2026-03-10:
9841
+ * - Free: 1 provider, 3 procedures, 3 appts/mo, 10 msgs/mo, 1 staff, 1 location
9842
+ * - Connect (CHF 59/mo): unlimited providers, 15 procedures, 100 appts/mo, unlimited msgs, 5 staff, 1 location
9843
+ * - Pro (CHF 149/mo): unlimited everything
9844
+ */
9845
+ declare const TIER_CONFIG: Record<string, TierConfig>;
9846
+ /**
9847
+ * Default permissions per ClinicRole.
9848
+ * These are the baseline permissions for each role; owners can override per-user.
9849
+ */
9850
+ declare const DEFAULT_ROLE_PERMISSIONS: Record<ClinicRole, Record<string, boolean>>;
9851
+ /**
9852
+ * Resolves the effective tier for a subscription model string.
9853
+ */
9854
+ declare function resolveEffectiveTier(subscriptionModel: string): string;
9855
+
9856
+ export { AESTHETIC_ANALYSIS_COLLECTION, ANALYTICS_COLLECTION, APPOINTMENTS_COLLECTION, type ASAClassification, AcquisitionSource, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type AestheticAnalysis, type AestheticAnalysisStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, AnalyticsCloudService, type AnalyticsDateRange, type AnalyticsFilters, type AnalyticsMetadata, type AnalyticsPeriod, AnalyticsService, type AnesthesiaHistory, type Appointment, type AppointmentCancelledNotification, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentProductMetadata, type AppointmentReminderNotification, type AppointmentRescheduledProposalNotification, type AppointmentRescheduledReminderNotification, AppointmentService, AppointmentStatus, type AppointmentStatusChangeNotification, type AppointmentTrend, type AssessmentScales, AuthService, BODY_ASSESSMENT_COLLECTION, type BaseDocumentElement, type BaseMetrics, type BaseNotification, BaseService, type BeforeAfterPerZone, type BillingInfo, type BillingPerZone, type BillingTransaction, BillingTransactionType, BillingTransactionsService, type BinaryChoiceElement, type BleedingRisk, type BleedingRiskLevel, BlockingCondition, type BodyAssessment, type BodyAssessmentStatus, type BodyCompositionData, type BodyMeasurementsData, type BodySymmetryData, type BodyZone, type BodyZoneAssessment, type Brand, BrandService, type Break, CALENDAR_COLLECTION, CANCELLATION_ANALYTICS_SUBCOLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_ANALYTICS_SUBCOLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarServiceV3, CalendarSyncStatus, type CancellationMetrics, type CancellationRateTrend, type CancellationReasonStats, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type ClearanceStatus, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicAnalytics, type ClinicBranchSetupData, type ClinicComparisonMetrics, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicRole, ClinicService, type ClinicStaffMember, ClinicTag, type ClinicTags, type ClinicalFindingDetail, type ClinicalFindings, ConstantsService, type ContactPerson, Contraindication, type ContraindicationDynamic, CosmeticAllergySubtype, type CostPerPatientMetrics, type CreateAdminTokenData, type CreateAestheticAnalysisData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateBillingTransactionData, type CreateBlockingEventParams, type CreateBodyAssessmentData, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreateHairScalpAssessmentData, type CreateManualPatientData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePatientTokenData, type CreatePractitionerData, type CreatePractitionerInviteData, type CreatePractitionerTokenData, type CreatePreSurgicalAssessmentData, type CreateProcedureData, type CreateSkinQualityAssessmentData, type CreateSyncedCalendarData, type CreateUserData, Currency, DASHBOARD_ANALYTICS_SUBCOLLECTION, DEFAULT_MEDICAL_INFO, DEFAULT_ROLE_PERMISSIONS, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DashboardAnalytics, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DurationTrend, type DynamicTextElement, DynamicVariable, type ElastosisGrade, type EmergencyContact, type EntityType, EnvironmentalAllergySubtype, type ExtendedProcedureInfo, ExternalCalendarService, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, type FinalBilling, type FirebaseUser, type FitzpatrickType, FoodAllergySubtype, type FormReminderNotification, type FormSubmissionConfirmationNotification, type GamificationInfo, Gender, type GeneralMessageNotification, type GlogauClassification, type GroupedAnalyticsBase, type GroupedPatientBehaviorMetrics, type GroupedPatientRetentionMetrics, type GroupedPractitionerPerformanceMetrics, type GroupedProcedurePerformanceMetrics, type GroupedProductUsageMetrics, type GroupedRevenueMetrics, type GroupedTimeEfficiencyMetrics, type GroupingPeriod, HAIR_SCALP_ASSESSMENT_COLLECTION, type HairCharacteristics, type HairColor, type HairDensity, type HairLossPattern, type HairLossType, type HairLossZone, type HairLossZoneAssessment, type HairScalpAssessment, type HairScalpAssessmentStatus, type HairTextureGrade, type HairType, type HeadingElement, HeadingLevel, INVITE_TOKENS_COLLECTION, type LabResult, Language, type LinkedFormInfo, type ListElement, ListType, type LocationData, type LudwigStage, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MediaType, MedicationAllergySubtype, type MultipleChoiceElement, type MuscleDefinitionLevel, NOTIFICATIONS_COLLECTION, NO_SHOW_ANALYTICS_SUBCOLLECTION, type NextStepsRecommendation, type NoShowMetrics, type NorwoodStage, type Notification, NotificationService, NotificationStatus, NotificationType, type OverallReviewAverages, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PERMISSION_KEYS, PRACTITIONERS_COLLECTION, PRACTITIONER_ANALYTICS_SUBCOLLECTION, PRACTITIONER_INVITES_COLLECTION, PRE_SURGICAL_ASSESSMENT_COLLECTION, PROCEDURES_COLLECTION, PROCEDURE_ANALYTICS_SUBCOLLECTION, type ParagraphElement, type PatientAnalytics, type PatientClinic, type PatientDoctor, type PatientGoals, PatientInstructionStatus, type PatientLifetimeValueMetrics, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileForDoctor, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, type PatientRequirementsFilters, PatientRequirementsService, type PatientRetentionMetrics, type PatientReviewInfo, type PatientSensitiveInfo, PatientService, type PatientToken, PatientTokenStatus, type PaymentConfirmationNotification, PaymentStatus, type PaymentStatusBreakdown, type PermissionKey, type PlanDetails, type PoreSizeLevel, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerAnalytics, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerInvite, type PractitionerInviteFilters, PractitionerInviteService, PractitionerInviteStatus, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, type PreSurgicalAssessment, type PreSurgicalAssessmentStatus, PricingMeasure, type Procedure, type ProcedureAnalytics, type ProcedureCategorization, type ProcedureExtendedInfo, ProcedureFamily, type ProcedureInfo, type ProcedurePopularity, type ProcedureProduct, type ProcedureProfitability, type ProcedureRecommendationNotification, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type ProcedureSummaryInfo, type Product, type ProductRevenueMetrics, ProductService, type ProductUsageByProcedure, type ProductUsageMetrics, type ProposedWorkingHours, REGISTER_TOKENS_COLLECTION, REVENUE_ANALYTICS_SUBCOLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type ReadStoredAnalyticsOptions, type RecommendedProcedure, type RequesterInfo, type Requirement, type RequirementInstructionDueNotification, type RequirementSourceProcedure, RequirementType, type RevenueMetrics, type RevenueTrend, type Review, type ReviewAnalyticsMetrics, ReviewAnalyticsService, type ReviewDetail, type ReviewMetrics, type ReviewRequestNotification, ReviewService, type ReviewTrend, type RolePermissionConfig, SKIN_QUALITY_ASSESSMENT_COLLECTION, SYNCED_CALENDARS_COLLECTION, type ScalpCondition, type ScalpRednessLevel, type ScalpScalinessLevel, type ScalpSebumLevel, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SeverityLevel, type SignatureElement, type SingleChoiceElement, type SkinCharacteristics, type SkinConditionEntry, type SkinConditionType, type SkinElasticityLevel, type SkinHydrationLevel, type SkinQualityAssessment, type SkinQualityAssessmentStatus, type SkinQualityScales, type SkinSensitivityLevel, type SkinTextureLevel, type SkinZone, type SkinZoneAssessment, type SmokingStatus, type StoredCancellationMetrics, type StoredClinicAnalytics, type StoredDashboardAnalytics, type StoredNoShowMetrics, type StoredPractitionerAnalytics, type StoredProcedureAnalytics, type StoredRevenueMetrics, type StoredTimeEfficiencyMetrics, type StripeTransactionData, type Subcategory, SubcategoryService, SubscriptionModel, SubscriptionStatus, type SurgicalSiteAssessment, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, TIER_CONFIG, TIME_EFFICIENCY_ANALYTICS_SUBCOLLECTION, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TierConfig, TierLimitError, type TierLimits, type TimeEfficiencyMetrics, type TimeSlot, TimeUnit, type TissueQualityLevel, TreatmentBenefit, type TreatmentBenefitDynamic, type TrendPeriod, USERS_COLLECTION, USER_FORMS_SUBCOLLECTION, type UpdateAestheticAnalysisData, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateBlockingEventParams, type UpdateBodyAssessmentData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateHairScalpAssessmentData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdatePractitionerInviteData, type UpdatePreSurgicalAssessmentData, type UpdateProcedureData, type UpdateSkinQualityAssessmentData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type VitalStats, type WorkingHours, type ZoneItemData, type ZonePhotoUploadData, enforceAppointmentLimit, enforceBranchLimit, enforceMessageLimit, enforceProcedureLimit, enforceProviderLimit, enforceStaffLimit, getEffectiveTier, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseFunctions, getFirebaseInstance, getFirebaseStorage, initializeFirebase, resolveEffectiveTier };
package/dist/index.d.ts CHANGED
@@ -5308,6 +5308,64 @@ interface ProcedureSummaryInfo {
5308
5308
  practitionerName: string;
5309
5309
  }
5310
5310
 
5311
+ /**
5312
+ * RBAC (Role-Based Access Control) types for clinic staff management
5313
+ */
5314
+ /**
5315
+ * Roles that can be assigned to clinic staff members
5316
+ */
5317
+ declare enum ClinicRole {
5318
+ OWNER = "owner",
5319
+ ADMIN = "admin",
5320
+ DOCTOR = "doctor",
5321
+ RECEPTIONIST = "receptionist",
5322
+ ASSISTANT = "assistant"
5323
+ }
5324
+ /**
5325
+ * Represents a staff member within a clinic group
5326
+ */
5327
+ interface ClinicStaffMember {
5328
+ id?: string;
5329
+ userId: string;
5330
+ clinicGroupId: string;
5331
+ clinicId?: string;
5332
+ role: ClinicRole;
5333
+ permissions: Record<string, boolean>;
5334
+ isActive: boolean;
5335
+ createdAt?: any;
5336
+ updatedAt?: any;
5337
+ }
5338
+ /**
5339
+ * Configuration for default permissions assigned to a role
5340
+ */
5341
+ interface RolePermissionConfig {
5342
+ clinicGroupId?: string;
5343
+ role: ClinicRole;
5344
+ permissions: Record<string, boolean>;
5345
+ }
5346
+ /**
5347
+ * Usage limits for a given subscription tier.
5348
+ * All features are available on every tier — only usage is capped.
5349
+ * -1 means unlimited.
5350
+ */
5351
+ interface TierLimits {
5352
+ maxProviders: number;
5353
+ maxProcedures: number;
5354
+ maxAppointmentsPerMonth: number;
5355
+ maxMessagesPerMonth: number;
5356
+ maxStaff: number;
5357
+ maxBranches: number;
5358
+ }
5359
+ /**
5360
+ * Configuration for a subscription tier.
5361
+ * Every tier has access to all features — tiers differ only in usage limits.
5362
+ */
5363
+ interface TierConfig {
5364
+ tier: string;
5365
+ name: string;
5366
+ limits: TierLimits;
5367
+ }
5368
+
5311
5369
  declare const CLINIC_GROUPS_COLLECTION = "clinic_groups";
5312
5370
  declare const CLINIC_ADMINS_COLLECTION = "clinic_admins";
5313
5371
  declare const CLINICS_COLLECTION = "clinics";
@@ -5461,9 +5519,15 @@ interface AdminInfo {
5461
5519
  */
5462
5520
  declare enum SubscriptionModel {
5463
5521
  NO_SUBSCRIPTION = "no_subscription",
5522
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
5464
5523
  BASIC = "basic",
5524
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
5465
5525
  PREMIUM = "premium",
5466
- ENTERPRISE = "enterprise"
5526
+ /** @deprecated Use FREE, CONNECT, or PRO instead */
5527
+ ENTERPRISE = "enterprise",
5528
+ FREE = "free",
5529
+ CONNECT = "connect",
5530
+ PRO = "pro"
5467
5531
  }
5468
5532
  /**
5469
5533
  * Enum for subscription status
@@ -5488,6 +5552,8 @@ interface BillingInfo {
5488
5552
  currentPeriodStart: Timestamp | null;
5489
5553
  currentPeriodEnd: Timestamp | null;
5490
5554
  updatedAt: Timestamp;
5555
+ seatCount?: number;
5556
+ seatPriceId?: string;
5491
5557
  }
5492
5558
  /**
5493
5559
  * Enum for billing transaction types
@@ -5578,6 +5644,12 @@ interface ClinicGroup {
5578
5644
  completed?: boolean;
5579
5645
  step?: number;
5580
5646
  };
5647
+ featureTrials?: {
5648
+ analytics?: {
5649
+ startedAt: Timestamp;
5650
+ durationDays: number;
5651
+ };
5652
+ };
5581
5653
  }
5582
5654
  /**
5583
5655
  * Interface for creating a clinic group
@@ -5658,6 +5730,7 @@ interface Clinic {
5658
5730
  isActive: boolean;
5659
5731
  isVerified: boolean;
5660
5732
  logo?: MediaResource | null;
5733
+ acceptingBookings?: boolean;
5661
5734
  }
5662
5735
  /**
5663
5736
  * Interface for creating a clinic
@@ -9665,6 +9738,48 @@ declare class ReviewService extends BaseService {
9665
9738
  private calculateAverage;
9666
9739
  }
9667
9740
 
9741
+ declare class TierLimitError extends Error {
9742
+ readonly code = "TIER_LIMIT_EXCEEDED";
9743
+ readonly currentTier: string;
9744
+ readonly resource: string;
9745
+ readonly currentCount: number;
9746
+ readonly maxAllowed: number;
9747
+ constructor(resource: string, currentTier: string, currentCount: number, maxAllowed: number);
9748
+ }
9749
+ /**
9750
+ * Fetches the effective tier for a clinic group.
9751
+ * Returns the resolved tier string (e.g., 'free', 'connect', 'pro').
9752
+ */
9753
+ declare function getEffectiveTier(db: Firestore, clinicGroupId: string): Promise<string>;
9754
+ /**
9755
+ * Enforces tier limit before adding a provider (practitioner/doctor/nurse/etc.).
9756
+ * Throws TierLimitError if the limit would be exceeded.
9757
+ */
9758
+ declare function enforceProviderLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9759
+ /**
9760
+ * Enforces tier limit before creating a procedure.
9761
+ * @param count - Number of procedures being created (default 1, higher for bulk)
9762
+ */
9763
+ declare function enforceProcedureLimit(db: Firestore, clinicGroupId: string, count?: number): Promise<void>;
9764
+ /**
9765
+ * Enforces tier limit before creating a clinic branch.
9766
+ */
9767
+ declare function enforceBranchLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9768
+ /**
9769
+ * Enforces tier limit before creating a staff member.
9770
+ */
9771
+ declare function enforceStaffLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9772
+ /**
9773
+ * Enforces tier limit before creating an appointment.
9774
+ * Reads the monthly counter from clinic_groups/{id}/usage_counters/{YYYY-MM}.
9775
+ */
9776
+ declare function enforceAppointmentLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9777
+ /**
9778
+ * Enforces tier limit before sending a message.
9779
+ * Reads the monthly counter from clinic_groups/{id}/usage_counters/{YYYY-MM}.
9780
+ */
9781
+ declare function enforceMessageLimit(db: Firestore, clinicGroupId: string): Promise<void>;
9782
+
9668
9783
  interface FirebaseInstance {
9669
9784
  app: FirebaseApp;
9670
9785
  db: Firestore;
@@ -9689,4 +9804,53 @@ declare const getFirebaseApp: () => Promise<FirebaseApp>;
9689
9804
  declare const getFirebaseStorage: () => Promise<FirebaseStorage>;
9690
9805
  declare const getFirebaseFunctions: () => Promise<Functions>;
9691
9806
 
9692
- export { AESTHETIC_ANALYSIS_COLLECTION, ANALYTICS_COLLECTION, APPOINTMENTS_COLLECTION, type ASAClassification, AcquisitionSource, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type AestheticAnalysis, type AestheticAnalysisStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, AnalyticsCloudService, type AnalyticsDateRange, type AnalyticsFilters, type AnalyticsMetadata, type AnalyticsPeriod, AnalyticsService, type AnesthesiaHistory, type Appointment, type AppointmentCancelledNotification, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentProductMetadata, type AppointmentReminderNotification, type AppointmentRescheduledProposalNotification, type AppointmentRescheduledReminderNotification, AppointmentService, AppointmentStatus, type AppointmentStatusChangeNotification, type AppointmentTrend, type AssessmentScales, AuthService, BODY_ASSESSMENT_COLLECTION, type BaseDocumentElement, type BaseMetrics, type BaseNotification, BaseService, type BeforeAfterPerZone, type BillingInfo, type BillingPerZone, type BillingTransaction, BillingTransactionType, BillingTransactionsService, type BinaryChoiceElement, type BleedingRisk, type BleedingRiskLevel, BlockingCondition, type BodyAssessment, type BodyAssessmentStatus, type BodyCompositionData, type BodyMeasurementsData, type BodySymmetryData, type BodyZone, type BodyZoneAssessment, type Brand, BrandService, type Break, CALENDAR_COLLECTION, CANCELLATION_ANALYTICS_SUBCOLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_ANALYTICS_SUBCOLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarServiceV3, CalendarSyncStatus, type CancellationMetrics, type CancellationRateTrend, type CancellationReasonStats, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type ClearanceStatus, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicAnalytics, type ClinicBranchSetupData, type ClinicComparisonMetrics, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ClinicalFindingDetail, type ClinicalFindings, ConstantsService, type ContactPerson, Contraindication, type ContraindicationDynamic, CosmeticAllergySubtype, type CostPerPatientMetrics, type CreateAdminTokenData, type CreateAestheticAnalysisData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateBillingTransactionData, type CreateBlockingEventParams, type CreateBodyAssessmentData, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreateHairScalpAssessmentData, type CreateManualPatientData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePatientTokenData, type CreatePractitionerData, type CreatePractitionerInviteData, type CreatePractitionerTokenData, type CreatePreSurgicalAssessmentData, type CreateProcedureData, type CreateSkinQualityAssessmentData, type CreateSyncedCalendarData, type CreateUserData, Currency, DASHBOARD_ANALYTICS_SUBCOLLECTION, DEFAULT_MEDICAL_INFO, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DashboardAnalytics, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DurationTrend, type DynamicTextElement, DynamicVariable, type ElastosisGrade, type EmergencyContact, type EntityType, EnvironmentalAllergySubtype, type ExtendedProcedureInfo, ExternalCalendarService, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, type FinalBilling, type FirebaseUser, type FitzpatrickType, FoodAllergySubtype, type FormReminderNotification, type FormSubmissionConfirmationNotification, type GamificationInfo, Gender, type GeneralMessageNotification, type GlogauClassification, type GroupedAnalyticsBase, type GroupedPatientBehaviorMetrics, type GroupedPatientRetentionMetrics, type GroupedPractitionerPerformanceMetrics, type GroupedProcedurePerformanceMetrics, type GroupedProductUsageMetrics, type GroupedRevenueMetrics, type GroupedTimeEfficiencyMetrics, type GroupingPeriod, HAIR_SCALP_ASSESSMENT_COLLECTION, type HairCharacteristics, type HairColor, type HairDensity, type HairLossPattern, type HairLossType, type HairLossZone, type HairLossZoneAssessment, type HairScalpAssessment, type HairScalpAssessmentStatus, type HairTextureGrade, type HairType, type HeadingElement, HeadingLevel, INVITE_TOKENS_COLLECTION, type LabResult, Language, type LinkedFormInfo, type ListElement, ListType, type LocationData, type LudwigStage, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MediaType, MedicationAllergySubtype, type MultipleChoiceElement, type MuscleDefinitionLevel, NOTIFICATIONS_COLLECTION, NO_SHOW_ANALYTICS_SUBCOLLECTION, type NextStepsRecommendation, type NoShowMetrics, type NorwoodStage, type Notification, NotificationService, NotificationStatus, NotificationType, type OverallReviewAverages, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PRACTITIONERS_COLLECTION, PRACTITIONER_ANALYTICS_SUBCOLLECTION, PRACTITIONER_INVITES_COLLECTION, PRE_SURGICAL_ASSESSMENT_COLLECTION, PROCEDURES_COLLECTION, PROCEDURE_ANALYTICS_SUBCOLLECTION, type ParagraphElement, type PatientAnalytics, type PatientClinic, type PatientDoctor, type PatientGoals, PatientInstructionStatus, type PatientLifetimeValueMetrics, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileForDoctor, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, type PatientRequirementsFilters, PatientRequirementsService, type PatientRetentionMetrics, type PatientReviewInfo, type PatientSensitiveInfo, PatientService, type PatientToken, PatientTokenStatus, type PaymentConfirmationNotification, PaymentStatus, type PaymentStatusBreakdown, type PlanDetails, type PoreSizeLevel, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerAnalytics, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerInvite, type PractitionerInviteFilters, PractitionerInviteService, PractitionerInviteStatus, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, type PreSurgicalAssessment, type PreSurgicalAssessmentStatus, PricingMeasure, type Procedure, type ProcedureAnalytics, type ProcedureCategorization, type ProcedureExtendedInfo, ProcedureFamily, type ProcedureInfo, type ProcedurePopularity, type ProcedureProduct, type ProcedureProfitability, type ProcedureRecommendationNotification, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type ProcedureSummaryInfo, type Product, type ProductRevenueMetrics, ProductService, type ProductUsageByProcedure, type ProductUsageMetrics, type ProposedWorkingHours, REGISTER_TOKENS_COLLECTION, REVENUE_ANALYTICS_SUBCOLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type ReadStoredAnalyticsOptions, type RecommendedProcedure, type RequesterInfo, type Requirement, type RequirementInstructionDueNotification, type RequirementSourceProcedure, RequirementType, type RevenueMetrics, type RevenueTrend, type Review, type ReviewAnalyticsMetrics, ReviewAnalyticsService, type ReviewDetail, type ReviewMetrics, type ReviewRequestNotification, ReviewService, type ReviewTrend, SKIN_QUALITY_ASSESSMENT_COLLECTION, SYNCED_CALENDARS_COLLECTION, type ScalpCondition, type ScalpRednessLevel, type ScalpScalinessLevel, type ScalpSebumLevel, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SeverityLevel, type SignatureElement, type SingleChoiceElement, type SkinCharacteristics, type SkinConditionEntry, type SkinConditionType, type SkinElasticityLevel, type SkinHydrationLevel, type SkinQualityAssessment, type SkinQualityAssessmentStatus, type SkinQualityScales, type SkinSensitivityLevel, type SkinTextureLevel, type SkinZone, type SkinZoneAssessment, type SmokingStatus, type StoredCancellationMetrics, type StoredClinicAnalytics, type StoredDashboardAnalytics, type StoredNoShowMetrics, type StoredPractitionerAnalytics, type StoredProcedureAnalytics, type StoredRevenueMetrics, type StoredTimeEfficiencyMetrics, type StripeTransactionData, type Subcategory, SubcategoryService, SubscriptionModel, SubscriptionStatus, type SurgicalSiteAssessment, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, TIME_EFFICIENCY_ANALYTICS_SUBCOLLECTION, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TimeEfficiencyMetrics, type TimeSlot, TimeUnit, type TissueQualityLevel, TreatmentBenefit, type TreatmentBenefitDynamic, type TrendPeriod, USERS_COLLECTION, USER_FORMS_SUBCOLLECTION, type UpdateAestheticAnalysisData, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateBlockingEventParams, type UpdateBodyAssessmentData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateHairScalpAssessmentData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdatePractitionerInviteData, type UpdatePreSurgicalAssessmentData, type UpdateProcedureData, type UpdateSkinQualityAssessmentData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type VitalStats, type WorkingHours, type ZoneItemData, type ZonePhotoUploadData, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseFunctions, getFirebaseInstance, getFirebaseStorage, initializeFirebase };
9807
+ /**
9808
+ * Permission keys used for role-based access control.
9809
+ * Every feature is available on every tier — these only control
9810
+ * what a given role (owner/admin/doctor/etc.) can do.
9811
+ */
9812
+ declare const PERMISSION_KEYS: {
9813
+ readonly 'clinic.view': true;
9814
+ readonly 'clinic.edit': true;
9815
+ readonly 'reviews.view': true;
9816
+ readonly 'calendar.view': true;
9817
+ readonly 'appointments.view': true;
9818
+ readonly 'appointments.confirm': true;
9819
+ readonly 'appointments.cancel': true;
9820
+ readonly messaging: true;
9821
+ readonly 'procedures.view': true;
9822
+ readonly 'procedures.create': true;
9823
+ readonly 'procedures.edit': true;
9824
+ readonly 'procedures.delete': true;
9825
+ readonly 'patients.view': true;
9826
+ readonly 'patients.edit': true;
9827
+ readonly 'providers.view': true;
9828
+ readonly 'providers.manage': true;
9829
+ readonly 'analytics.view': true;
9830
+ readonly 'staff.manage': true;
9831
+ readonly 'settings.manage': true;
9832
+ readonly 'billing.manage': true;
9833
+ };
9834
+ type PermissionKey = keyof typeof PERMISSION_KEYS;
9835
+ /**
9836
+ * Usage limits per subscription tier.
9837
+ * All features are available on every tier — tiers differ only in usage caps.
9838
+ * -1 means unlimited.
9839
+ *
9840
+ * Confirmed by client on 2026-03-10:
9841
+ * - Free: 1 provider, 3 procedures, 3 appts/mo, 10 msgs/mo, 1 staff, 1 location
9842
+ * - Connect (CHF 59/mo): unlimited providers, 15 procedures, 100 appts/mo, unlimited msgs, 5 staff, 1 location
9843
+ * - Pro (CHF 149/mo): unlimited everything
9844
+ */
9845
+ declare const TIER_CONFIG: Record<string, TierConfig>;
9846
+ /**
9847
+ * Default permissions per ClinicRole.
9848
+ * These are the baseline permissions for each role; owners can override per-user.
9849
+ */
9850
+ declare const DEFAULT_ROLE_PERMISSIONS: Record<ClinicRole, Record<string, boolean>>;
9851
+ /**
9852
+ * Resolves the effective tier for a subscription model string.
9853
+ */
9854
+ declare function resolveEffectiveTier(subscriptionModel: string): string;
9855
+
9856
+ export { AESTHETIC_ANALYSIS_COLLECTION, ANALYTICS_COLLECTION, APPOINTMENTS_COLLECTION, type ASAClassification, AcquisitionSource, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type AestheticAnalysis, type AestheticAnalysisStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, AnalyticsCloudService, type AnalyticsDateRange, type AnalyticsFilters, type AnalyticsMetadata, type AnalyticsPeriod, AnalyticsService, type AnesthesiaHistory, type Appointment, type AppointmentCancelledNotification, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentProductMetadata, type AppointmentReminderNotification, type AppointmentRescheduledProposalNotification, type AppointmentRescheduledReminderNotification, AppointmentService, AppointmentStatus, type AppointmentStatusChangeNotification, type AppointmentTrend, type AssessmentScales, AuthService, BODY_ASSESSMENT_COLLECTION, type BaseDocumentElement, type BaseMetrics, type BaseNotification, BaseService, type BeforeAfterPerZone, type BillingInfo, type BillingPerZone, type BillingTransaction, BillingTransactionType, BillingTransactionsService, type BinaryChoiceElement, type BleedingRisk, type BleedingRiskLevel, BlockingCondition, type BodyAssessment, type BodyAssessmentStatus, type BodyCompositionData, type BodyMeasurementsData, type BodySymmetryData, type BodyZone, type BodyZoneAssessment, type Brand, BrandService, type Break, CALENDAR_COLLECTION, CANCELLATION_ANALYTICS_SUBCOLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_ANALYTICS_SUBCOLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarServiceV3, CalendarSyncStatus, type CancellationMetrics, type CancellationRateTrend, type CancellationReasonStats, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type ClearanceStatus, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicAnalytics, type ClinicBranchSetupData, type ClinicComparisonMetrics, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicRole, ClinicService, type ClinicStaffMember, ClinicTag, type ClinicTags, type ClinicalFindingDetail, type ClinicalFindings, ConstantsService, type ContactPerson, Contraindication, type ContraindicationDynamic, CosmeticAllergySubtype, type CostPerPatientMetrics, type CreateAdminTokenData, type CreateAestheticAnalysisData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateBillingTransactionData, type CreateBlockingEventParams, type CreateBodyAssessmentData, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreateHairScalpAssessmentData, type CreateManualPatientData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePatientTokenData, type CreatePractitionerData, type CreatePractitionerInviteData, type CreatePractitionerTokenData, type CreatePreSurgicalAssessmentData, type CreateProcedureData, type CreateSkinQualityAssessmentData, type CreateSyncedCalendarData, type CreateUserData, Currency, DASHBOARD_ANALYTICS_SUBCOLLECTION, DEFAULT_MEDICAL_INFO, DEFAULT_ROLE_PERMISSIONS, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DashboardAnalytics, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DurationTrend, type DynamicTextElement, DynamicVariable, type ElastosisGrade, type EmergencyContact, type EntityType, EnvironmentalAllergySubtype, type ExtendedProcedureInfo, ExternalCalendarService, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, type FilledDocumentFileValue, FilledDocumentService, FilledDocumentStatus, type FinalBilling, type FirebaseUser, type FitzpatrickType, FoodAllergySubtype, type FormReminderNotification, type FormSubmissionConfirmationNotification, type GamificationInfo, Gender, type GeneralMessageNotification, type GlogauClassification, type GroupedAnalyticsBase, type GroupedPatientBehaviorMetrics, type GroupedPatientRetentionMetrics, type GroupedPractitionerPerformanceMetrics, type GroupedProcedurePerformanceMetrics, type GroupedProductUsageMetrics, type GroupedRevenueMetrics, type GroupedTimeEfficiencyMetrics, type GroupingPeriod, HAIR_SCALP_ASSESSMENT_COLLECTION, type HairCharacteristics, type HairColor, type HairDensity, type HairLossPattern, type HairLossType, type HairLossZone, type HairLossZoneAssessment, type HairScalpAssessment, type HairScalpAssessmentStatus, type HairTextureGrade, type HairType, type HeadingElement, HeadingLevel, INVITE_TOKENS_COLLECTION, type LabResult, Language, type LinkedFormInfo, type ListElement, ListType, type LocationData, type LudwigStage, MEDIA_METADATA_COLLECTION, MediaAccessLevel, type MediaMetadata, type MediaResource, MediaService, MediaType, MedicationAllergySubtype, type MultipleChoiceElement, type MuscleDefinitionLevel, NOTIFICATIONS_COLLECTION, NO_SHOW_ANALYTICS_SUBCOLLECTION, type NextStepsRecommendation, type NoShowMetrics, type NorwoodStage, type Notification, NotificationService, NotificationStatus, NotificationType, type OverallReviewAverages, PATIENTS_COLLECTION, PATIENT_APPOINTMENTS_COLLECTION, PATIENT_LOCATION_INFO_COLLECTION, PATIENT_MEDICAL_HISTORY_COLLECTION, PATIENT_MEDICAL_INFO_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, PERMISSION_KEYS, PRACTITIONERS_COLLECTION, PRACTITIONER_ANALYTICS_SUBCOLLECTION, PRACTITIONER_INVITES_COLLECTION, PRE_SURGICAL_ASSESSMENT_COLLECTION, PROCEDURES_COLLECTION, PROCEDURE_ANALYTICS_SUBCOLLECTION, type ParagraphElement, type PatientAnalytics, type PatientClinic, type PatientDoctor, type PatientGoals, PatientInstructionStatus, type PatientLifetimeValueMetrics, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileForDoctor, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, type PatientRequirementsFilters, PatientRequirementsService, type PatientRetentionMetrics, type PatientReviewInfo, type PatientSensitiveInfo, PatientService, type PatientToken, PatientTokenStatus, type PaymentConfirmationNotification, PaymentStatus, type PaymentStatusBreakdown, type PermissionKey, type PlanDetails, type PoreSizeLevel, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerAnalytics, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerInvite, type PractitionerInviteFilters, PractitionerInviteService, PractitionerInviteStatus, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, type PreSurgicalAssessment, type PreSurgicalAssessmentStatus, PricingMeasure, type Procedure, type ProcedureAnalytics, type ProcedureCategorization, type ProcedureExtendedInfo, ProcedureFamily, type ProcedureInfo, type ProcedurePopularity, type ProcedureProduct, type ProcedureProfitability, type ProcedureRecommendationNotification, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type ProcedureSummaryInfo, type Product, type ProductRevenueMetrics, ProductService, type ProductUsageByProcedure, type ProductUsageMetrics, type ProposedWorkingHours, REGISTER_TOKENS_COLLECTION, REVENUE_ANALYTICS_SUBCOLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type ReadStoredAnalyticsOptions, type RecommendedProcedure, type RequesterInfo, type Requirement, type RequirementInstructionDueNotification, type RequirementSourceProcedure, RequirementType, type RevenueMetrics, type RevenueTrend, type Review, type ReviewAnalyticsMetrics, ReviewAnalyticsService, type ReviewDetail, type ReviewMetrics, type ReviewRequestNotification, ReviewService, type ReviewTrend, type RolePermissionConfig, SKIN_QUALITY_ASSESSMENT_COLLECTION, SYNCED_CALENDARS_COLLECTION, type ScalpCondition, type ScalpRednessLevel, type ScalpScalinessLevel, type ScalpSebumLevel, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SeverityLevel, type SignatureElement, type SingleChoiceElement, type SkinCharacteristics, type SkinConditionEntry, type SkinConditionType, type SkinElasticityLevel, type SkinHydrationLevel, type SkinQualityAssessment, type SkinQualityAssessmentStatus, type SkinQualityScales, type SkinSensitivityLevel, type SkinTextureLevel, type SkinZone, type SkinZoneAssessment, type SmokingStatus, type StoredCancellationMetrics, type StoredClinicAnalytics, type StoredDashboardAnalytics, type StoredNoShowMetrics, type StoredPractitionerAnalytics, type StoredProcedureAnalytics, type StoredRevenueMetrics, type StoredTimeEfficiencyMetrics, type StripeTransactionData, type Subcategory, SubcategoryService, SubscriptionModel, SubscriptionStatus, type SurgicalSiteAssessment, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, TIER_CONFIG, TIME_EFFICIENCY_ANALYTICS_SUBCOLLECTION, type Technology, type TechnologyDocumentationTemplate, TechnologyService, type TextInputElement, type TierConfig, TierLimitError, type TierLimits, type TimeEfficiencyMetrics, type TimeSlot, TimeUnit, type TissueQualityLevel, TreatmentBenefit, type TreatmentBenefitDynamic, type TrendPeriod, USERS_COLLECTION, USER_FORMS_SUBCOLLECTION, type UpdateAestheticAnalysisData, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateBlockingEventParams, type UpdateBodyAssessmentData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateHairScalpAssessmentData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdatePractitionerInviteData, type UpdatePreSurgicalAssessmentData, type UpdateProcedureData, type UpdateSkinQualityAssessmentData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type VitalStats, type WorkingHours, type ZoneItemData, type ZonePhotoUploadData, enforceAppointmentLimit, enforceBranchLimit, enforceMessageLimit, enforceProcedureLimit, enforceProviderLimit, enforceStaffLimit, getEffectiveTier, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseFunctions, getFirebaseInstance, getFirebaseStorage, initializeFirebase, resolveEffectiveTier };