@blackcode_sa/metaestetics-api 1.6.21 → 1.6.22

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.
@@ -376,17 +376,17 @@ declare enum HeadingLevel {
376
376
  * Enum for dynamic variable placeholders
377
377
  */
378
378
  declare enum DynamicVariable {
379
- PATIENT_NAME = "[PATIENT_NAME]",
380
- DOCTOR_NAME = "[DOCTOR_NAME]",
381
- CLINIC_NAME = "[CLINIC_NAME]",
382
- PATIENT_BIRTHDAY = "[PATIENT_BIRTHDAY]",
383
- APPOINTMENT_DATE = "[APPOINTMENT_DATE]",
384
- CURRENT_DATE = "[CURRENT_DATE]",
385
- PROCEDURE_NAME = "[PROCEDURE_NAME]",
386
- PROCEDURE_DESCRIPTION = "[PROCEDURE_DESCRIPTION]",
387
- PROCEDURE_COST = "[PROCEDURE_COST]",
388
- PROCEDURE_DURATION = "[PROCEDURE_DURATION]",
389
- PROCEDURE_RISK = "[PROCEDURE_RISK]"
379
+ PATIENT_NAME = "$[PATIENT_NAME]",
380
+ DOCTOR_NAME = "$[DOCTOR_NAME]",
381
+ CLINIC_NAME = "$[CLINIC_NAME]",
382
+ PATIENT_BIRTHDAY = "$[PATIENT_BIRTHDAY]",
383
+ APPOINTMENT_DATE = "$[APPOINTMENT_DATE]",
384
+ CURRENT_DATE = "$[CURRENT_DATE]",
385
+ PROCEDURE_NAME = "$[PROCEDURE_NAME]",
386
+ PROCEDURE_DESCRIPTION = "$[PROCEDURE_DESCRIPTION]",
387
+ PROCEDURE_COST = "$[PROCEDURE_COST]",
388
+ PROCEDURE_DURATION = "$[PROCEDURE_DURATION]",
389
+ PROCEDURE_RISK = "$[PROCEDURE_RISK]"
390
390
  }
391
391
  /**
392
392
  * Base interface for all document elements
@@ -376,17 +376,17 @@ declare enum HeadingLevel {
376
376
  * Enum for dynamic variable placeholders
377
377
  */
378
378
  declare enum DynamicVariable {
379
- PATIENT_NAME = "[PATIENT_NAME]",
380
- DOCTOR_NAME = "[DOCTOR_NAME]",
381
- CLINIC_NAME = "[CLINIC_NAME]",
382
- PATIENT_BIRTHDAY = "[PATIENT_BIRTHDAY]",
383
- APPOINTMENT_DATE = "[APPOINTMENT_DATE]",
384
- CURRENT_DATE = "[CURRENT_DATE]",
385
- PROCEDURE_NAME = "[PROCEDURE_NAME]",
386
- PROCEDURE_DESCRIPTION = "[PROCEDURE_DESCRIPTION]",
387
- PROCEDURE_COST = "[PROCEDURE_COST]",
388
- PROCEDURE_DURATION = "[PROCEDURE_DURATION]",
389
- PROCEDURE_RISK = "[PROCEDURE_RISK]"
379
+ PATIENT_NAME = "$[PATIENT_NAME]",
380
+ DOCTOR_NAME = "$[DOCTOR_NAME]",
381
+ CLINIC_NAME = "$[CLINIC_NAME]",
382
+ PATIENT_BIRTHDAY = "$[PATIENT_BIRTHDAY]",
383
+ APPOINTMENT_DATE = "$[APPOINTMENT_DATE]",
384
+ CURRENT_DATE = "$[CURRENT_DATE]",
385
+ PROCEDURE_NAME = "$[PROCEDURE_NAME]",
386
+ PROCEDURE_DESCRIPTION = "$[PROCEDURE_DESCRIPTION]",
387
+ PROCEDURE_COST = "$[PROCEDURE_COST]",
388
+ PROCEDURE_DURATION = "$[PROCEDURE_DURATION]",
389
+ PROCEDURE_RISK = "$[PROCEDURE_RISK]"
390
390
  }
391
391
  /**
392
392
  * Base interface for all document elements
@@ -239,17 +239,17 @@ var HeadingLevel = /* @__PURE__ */ ((HeadingLevel2) => {
239
239
  return HeadingLevel2;
240
240
  })(HeadingLevel || {});
241
241
  var DynamicVariable = /* @__PURE__ */ ((DynamicVariable2) => {
242
- DynamicVariable2["PATIENT_NAME"] = "[PATIENT_NAME]";
243
- DynamicVariable2["DOCTOR_NAME"] = "[DOCTOR_NAME]";
244
- DynamicVariable2["CLINIC_NAME"] = "[CLINIC_NAME]";
245
- DynamicVariable2["PATIENT_BIRTHDAY"] = "[PATIENT_BIRTHDAY]";
246
- DynamicVariable2["APPOINTMENT_DATE"] = "[APPOINTMENT_DATE]";
247
- DynamicVariable2["CURRENT_DATE"] = "[CURRENT_DATE]";
248
- DynamicVariable2["PROCEDURE_NAME"] = "[PROCEDURE_NAME]";
249
- DynamicVariable2["PROCEDURE_DESCRIPTION"] = "[PROCEDURE_DESCRIPTION]";
250
- DynamicVariable2["PROCEDURE_COST"] = "[PROCEDURE_COST]";
251
- DynamicVariable2["PROCEDURE_DURATION"] = "[PROCEDURE_DURATION]";
252
- DynamicVariable2["PROCEDURE_RISK"] = "[PROCEDURE_RISK]";
242
+ DynamicVariable2["PATIENT_NAME"] = "$[PATIENT_NAME]";
243
+ DynamicVariable2["DOCTOR_NAME"] = "$[DOCTOR_NAME]";
244
+ DynamicVariable2["CLINIC_NAME"] = "$[CLINIC_NAME]";
245
+ DynamicVariable2["PATIENT_BIRTHDAY"] = "$[PATIENT_BIRTHDAY]";
246
+ DynamicVariable2["APPOINTMENT_DATE"] = "$[APPOINTMENT_DATE]";
247
+ DynamicVariable2["CURRENT_DATE"] = "$[CURRENT_DATE]";
248
+ DynamicVariable2["PROCEDURE_NAME"] = "$[PROCEDURE_NAME]";
249
+ DynamicVariable2["PROCEDURE_DESCRIPTION"] = "$[PROCEDURE_DESCRIPTION]";
250
+ DynamicVariable2["PROCEDURE_COST"] = "$[PROCEDURE_COST]";
251
+ DynamicVariable2["PROCEDURE_DURATION"] = "$[PROCEDURE_DURATION]";
252
+ DynamicVariable2["PROCEDURE_RISK"] = "$[PROCEDURE_RISK]";
253
253
  return DynamicVariable2;
254
254
  })(DynamicVariable || {});
255
255
  var FilledDocumentStatus = /* @__PURE__ */ ((FilledDocumentStatus2) => {
@@ -1628,6 +1628,7 @@ var DocumentationTemplateService = class extends BaseService {
1628
1628
  * @returns The updated template
1629
1629
  */
1630
1630
  async updateTemplate(templateId, data) {
1631
+ var _a, _b, _c, _d, _e, _f;
1631
1632
  const validatedData = updateDocumentTemplateSchema.parse(data);
1632
1633
  const template = await this.getTemplateById(templateId);
1633
1634
  if (!template) {
@@ -1653,12 +1654,9 @@ var DocumentationTemplateService = class extends BaseService {
1653
1654
  updatePayload.isActive = validatedData.isActive;
1654
1655
  if (validatedData.tags !== void 0)
1655
1656
  updatePayload.tags = validatedData.tags;
1656
- if (validatedData.isUserForm !== void 0)
1657
- updatePayload.isUserForm = validatedData.isUserForm;
1658
- if (validatedData.isRequired !== void 0)
1659
- updatePayload.isRequired = validatedData.isRequired;
1660
- if (validatedData.sortingOrder !== void 0)
1661
- updatePayload.sortingOrder = validatedData.sortingOrder;
1657
+ updatePayload.isUserForm = (_b = (_a = validatedData.isUserForm) != null ? _a : template.isUserForm) != null ? _b : false;
1658
+ updatePayload.isRequired = (_d = (_c = validatedData.isRequired) != null ? _c : template.isRequired) != null ? _d : false;
1659
+ updatePayload.sortingOrder = (_f = (_e = validatedData.sortingOrder) != null ? _e : template.sortingOrder) != null ? _f : 0;
1662
1660
  const docRef = (0, import_firestore7.doc)(this.collectionRef, templateId);
1663
1661
  await (0, import_firestore7.updateDoc)(docRef, updatePayload);
1664
1662
  return { ...template, ...updatePayload };
@@ -1758,6 +1756,30 @@ var DocumentationTemplateService = class extends BaseService {
1758
1756
  lastDoc: lastVisible
1759
1757
  };
1760
1758
  }
1759
+ /**
1760
+ * Get all templates for selection with optional filtering
1761
+ * @param options - Filtering options
1762
+ * @returns Array of templates
1763
+ */
1764
+ async getAllTemplatesForSelection(options) {
1765
+ let q = (0, import_firestore7.query)(
1766
+ this.collectionRef,
1767
+ (0, import_firestore7.where)("isActive", "==", true),
1768
+ (0, import_firestore7.orderBy)("updatedAt", "desc")
1769
+ );
1770
+ if ((options == null ? void 0 : options.isUserForm) !== void 0) {
1771
+ q = (0, import_firestore7.query)(q, (0, import_firestore7.where)("isUserForm", "==", options.isUserForm));
1772
+ }
1773
+ if ((options == null ? void 0 : options.isRequired) !== void 0) {
1774
+ q = (0, import_firestore7.query)(q, (0, import_firestore7.where)("isRequired", "==", options.isRequired));
1775
+ }
1776
+ const querySnapshot = await (0, import_firestore7.getDocs)(q);
1777
+ const templates = [];
1778
+ querySnapshot.forEach((doc9) => {
1779
+ templates.push(doc9.data());
1780
+ });
1781
+ return templates;
1782
+ }
1761
1783
  };
1762
1784
 
1763
1785
  // src/services/documentation-templates/filled-document.service.ts
@@ -147,17 +147,17 @@ var HeadingLevel = /* @__PURE__ */ ((HeadingLevel2) => {
147
147
  return HeadingLevel2;
148
148
  })(HeadingLevel || {});
149
149
  var DynamicVariable = /* @__PURE__ */ ((DynamicVariable2) => {
150
- DynamicVariable2["PATIENT_NAME"] = "[PATIENT_NAME]";
151
- DynamicVariable2["DOCTOR_NAME"] = "[DOCTOR_NAME]";
152
- DynamicVariable2["CLINIC_NAME"] = "[CLINIC_NAME]";
153
- DynamicVariable2["PATIENT_BIRTHDAY"] = "[PATIENT_BIRTHDAY]";
154
- DynamicVariable2["APPOINTMENT_DATE"] = "[APPOINTMENT_DATE]";
155
- DynamicVariable2["CURRENT_DATE"] = "[CURRENT_DATE]";
156
- DynamicVariable2["PROCEDURE_NAME"] = "[PROCEDURE_NAME]";
157
- DynamicVariable2["PROCEDURE_DESCRIPTION"] = "[PROCEDURE_DESCRIPTION]";
158
- DynamicVariable2["PROCEDURE_COST"] = "[PROCEDURE_COST]";
159
- DynamicVariable2["PROCEDURE_DURATION"] = "[PROCEDURE_DURATION]";
160
- DynamicVariable2["PROCEDURE_RISK"] = "[PROCEDURE_RISK]";
150
+ DynamicVariable2["PATIENT_NAME"] = "$[PATIENT_NAME]";
151
+ DynamicVariable2["DOCTOR_NAME"] = "$[DOCTOR_NAME]";
152
+ DynamicVariable2["CLINIC_NAME"] = "$[CLINIC_NAME]";
153
+ DynamicVariable2["PATIENT_BIRTHDAY"] = "$[PATIENT_BIRTHDAY]";
154
+ DynamicVariable2["APPOINTMENT_DATE"] = "$[APPOINTMENT_DATE]";
155
+ DynamicVariable2["CURRENT_DATE"] = "$[CURRENT_DATE]";
156
+ DynamicVariable2["PROCEDURE_NAME"] = "$[PROCEDURE_NAME]";
157
+ DynamicVariable2["PROCEDURE_DESCRIPTION"] = "$[PROCEDURE_DESCRIPTION]";
158
+ DynamicVariable2["PROCEDURE_COST"] = "$[PROCEDURE_COST]";
159
+ DynamicVariable2["PROCEDURE_DURATION"] = "$[PROCEDURE_DURATION]";
160
+ DynamicVariable2["PROCEDURE_RISK"] = "$[PROCEDURE_RISK]";
161
161
  return DynamicVariable2;
162
162
  })(DynamicVariable || {});
163
163
  var FilledDocumentStatus = /* @__PURE__ */ ((FilledDocumentStatus2) => {
@@ -1605,6 +1605,7 @@ var DocumentationTemplateService = class extends BaseService {
1605
1605
  * @returns The updated template
1606
1606
  */
1607
1607
  async updateTemplate(templateId, data) {
1608
+ var _a, _b, _c, _d, _e, _f;
1608
1609
  const validatedData = updateDocumentTemplateSchema.parse(data);
1609
1610
  const template = await this.getTemplateById(templateId);
1610
1611
  if (!template) {
@@ -1630,12 +1631,9 @@ var DocumentationTemplateService = class extends BaseService {
1630
1631
  updatePayload.isActive = validatedData.isActive;
1631
1632
  if (validatedData.tags !== void 0)
1632
1633
  updatePayload.tags = validatedData.tags;
1633
- if (validatedData.isUserForm !== void 0)
1634
- updatePayload.isUserForm = validatedData.isUserForm;
1635
- if (validatedData.isRequired !== void 0)
1636
- updatePayload.isRequired = validatedData.isRequired;
1637
- if (validatedData.sortingOrder !== void 0)
1638
- updatePayload.sortingOrder = validatedData.sortingOrder;
1634
+ updatePayload.isUserForm = (_b = (_a = validatedData.isUserForm) != null ? _a : template.isUserForm) != null ? _b : false;
1635
+ updatePayload.isRequired = (_d = (_c = validatedData.isRequired) != null ? _c : template.isRequired) != null ? _d : false;
1636
+ updatePayload.sortingOrder = (_f = (_e = validatedData.sortingOrder) != null ? _e : template.sortingOrder) != null ? _f : 0;
1639
1637
  const docRef = doc7(this.collectionRef, templateId);
1640
1638
  await updateDoc7(docRef, updatePayload);
1641
1639
  return { ...template, ...updatePayload };
@@ -1735,6 +1733,30 @@ var DocumentationTemplateService = class extends BaseService {
1735
1733
  lastDoc: lastVisible
1736
1734
  };
1737
1735
  }
1736
+ /**
1737
+ * Get all templates for selection with optional filtering
1738
+ * @param options - Filtering options
1739
+ * @returns Array of templates
1740
+ */
1741
+ async getAllTemplatesForSelection(options) {
1742
+ let q = query7(
1743
+ this.collectionRef,
1744
+ where7("isActive", "==", true),
1745
+ orderBy("updatedAt", "desc")
1746
+ );
1747
+ if ((options == null ? void 0 : options.isUserForm) !== void 0) {
1748
+ q = query7(q, where7("isUserForm", "==", options.isUserForm));
1749
+ }
1750
+ if ((options == null ? void 0 : options.isRequired) !== void 0) {
1751
+ q = query7(q, where7("isRequired", "==", options.isRequired));
1752
+ }
1753
+ const querySnapshot = await getDocs7(q);
1754
+ const templates = [];
1755
+ querySnapshot.forEach((doc9) => {
1756
+ templates.push(doc9.data());
1757
+ });
1758
+ return templates;
1759
+ }
1738
1760
  };
1739
1761
 
1740
1762
  // src/services/documentation-templates/filled-document.service.ts
package/dist/index.d.mts CHANGED
@@ -362,6 +362,8 @@ interface CertificationRequirement {
362
362
  */
363
363
  declare const DOCUMENTATION_TEMPLATES_COLLECTION = "documentation-templates";
364
364
  declare const FILLED_DOCUMENTS_COLLECTION = "filled-documents";
365
+ declare const USER_FORMS_SUBCOLLECTION = "user-forms";
366
+ declare const DOCTOR_FORMS_SUBCOLLECTION = "doctor-forms";
365
367
  /**
366
368
  * Enum for element types in documentation templates
367
369
  */
@@ -402,17 +404,17 @@ declare enum HeadingLevel {
402
404
  * Enum for dynamic variable placeholders
403
405
  */
404
406
  declare enum DynamicVariable {
405
- PATIENT_NAME = "[PATIENT_NAME]",
406
- DOCTOR_NAME = "[DOCTOR_NAME]",
407
- CLINIC_NAME = "[CLINIC_NAME]",
408
- PATIENT_BIRTHDAY = "[PATIENT_BIRTHDAY]",
409
- APPOINTMENT_DATE = "[APPOINTMENT_DATE]",
410
- CURRENT_DATE = "[CURRENT_DATE]",
411
- PROCEDURE_NAME = "[PROCEDURE_NAME]",
412
- PROCEDURE_DESCRIPTION = "[PROCEDURE_DESCRIPTION]",
413
- PROCEDURE_COST = "[PROCEDURE_COST]",
414
- PROCEDURE_DURATION = "[PROCEDURE_DURATION]",
415
- PROCEDURE_RISK = "[PROCEDURE_RISK]"
407
+ PATIENT_NAME = "$[PATIENT_NAME]",
408
+ DOCTOR_NAME = "$[DOCTOR_NAME]",
409
+ CLINIC_NAME = "$[CLINIC_NAME]",
410
+ PATIENT_BIRTHDAY = "$[PATIENT_BIRTHDAY]",
411
+ APPOINTMENT_DATE = "$[APPOINTMENT_DATE]",
412
+ CURRENT_DATE = "$[CURRENT_DATE]",
413
+ PROCEDURE_NAME = "$[PROCEDURE_NAME]",
414
+ PROCEDURE_DESCRIPTION = "$[PROCEDURE_DESCRIPTION]",
415
+ PROCEDURE_COST = "$[PROCEDURE_COST]",
416
+ PROCEDURE_DURATION = "$[PROCEDURE_DURATION]",
417
+ PROCEDURE_RISK = "$[PROCEDURE_RISK]"
416
418
  }
417
419
  /**
418
420
  * Base interface for all document elements
@@ -516,6 +518,13 @@ interface SignatureElement extends BaseDocumentElement {
516
518
  type: DocumentElementType.SIGNATURE;
517
519
  label: string;
518
520
  }
521
+ /**
522
+ * Interface for digital signature element
523
+ */
524
+ interface DigitalSignatureElement extends BaseDocumentElement {
525
+ type: DocumentElementType.DITIGAL_SIGNATURE;
526
+ label: string;
527
+ }
519
528
  /**
520
529
  * Interface for file upload element
521
530
  */
@@ -6447,6 +6456,15 @@ declare class DocumentationTemplateService extends BaseService {
6447
6456
  templates: DocumentTemplate[];
6448
6457
  lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
6449
6458
  }>;
6459
+ /**
6460
+ * Get all templates for selection with optional filtering
6461
+ * @param options - Filtering options
6462
+ * @returns Array of templates
6463
+ */
6464
+ getAllTemplatesForSelection(options?: {
6465
+ isUserForm?: boolean;
6466
+ isRequired?: boolean;
6467
+ }): Promise<DocumentTemplate[]>;
6450
6468
  }
6451
6469
 
6452
6470
  /**
@@ -19127,4 +19145,4 @@ declare const createReviewSchema: z.ZodEffects<z.ZodObject<{
19127
19145
  } | undefined;
19128
19146
  }>;
19129
19147
 
19130
- export { APPOINTMENTS_COLLECTION, AUTH_ERRORS, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type Appointment, type AppointmentReminderNotification, AppointmentService, AppointmentStatus, AuthError, AuthService, type BaseNotification, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePractitionerData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DOCUMENTATION_TEMPLATES_COLLECTION, type DateRange, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, HeadingLevel, Language, ListType, type LocationData, MedicationAllergySubtype, type Notification, NotificationService, NotificationStatus, NotificationType, 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, PROCEDURES_COLLECTION, type PatientClinic, type PatientDoctor, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsService, type PatientSensitiveInfo, PatientService, PaymentStatus, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RequesterInfo, type Requirement, RequirementType, type Review, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, TechnologyService, type TimeSlot, TimeUnit, TreatmentBenefit, USER_ERRORS, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type ValidationSchema, type VitalStats, type WorkingHours, addAllergySchema, addBlockingConditionSchema, addContraindicationSchema, addMedicationSchema, addressDataSchema, adminInfoSchema, adminTokenSchema, allergySchema, allergySubtypeSchema, appointmentNotificationSchema, appointmentReminderNotificationSchema, baseNotificationSchema, blockingConditionSchema, calendarEventSchema, calendarEventTimeSchema, clinicAdminOptionsSchema, clinicAdminSchema, clinicAdminSignupSchema, clinicBranchSetupSchema, clinicContactInfoSchema, clinicGroupSchema, clinicGroupSetupSchema, clinicLocationSchema, clinicReviewInfoSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicReviewSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createFilledDocumentDataSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerReviewSchema, createPractitionerSchema, createPractitionerTokenSchema, createProcedureReviewSchema, createReviewSchema, createUserOptionsSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, filledDocumentSchema, filledDocumentStatusSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerSignupSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, procedureReviewInfoSchema, procedureReviewSchema, requesterInfoSchema, requirementInstructionDueNotificationSchema, reviewSchema, searchAppointmentsSchema, searchPatientsSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateFilledDocumentDataSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
19148
+ export { APPOINTMENTS_COLLECTION, AUTH_ERRORS, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type Appointment, type AppointmentReminderNotification, AppointmentService, AppointmentStatus, AuthError, AuthService, type BaseDocumentElement, type BaseNotification, type BinaryChoiceElement, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePractitionerData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, type HeadingElement, HeadingLevel, Language, type ListElement, ListType, type LocationData, MedicationAllergySubtype, type MultipleChoiceElement, type Notification, NotificationService, NotificationStatus, NotificationType, 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, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsService, type PatientSensitiveInfo, PatientService, PaymentStatus, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, RequirementType, type Review, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, USER_ERRORS, USER_FORMS_SUBCOLLECTION, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type ValidationSchema, type VitalStats, type WorkingHours, addAllergySchema, addBlockingConditionSchema, addContraindicationSchema, addMedicationSchema, addressDataSchema, adminInfoSchema, adminTokenSchema, allergySchema, allergySubtypeSchema, appointmentNotificationSchema, appointmentReminderNotificationSchema, baseNotificationSchema, blockingConditionSchema, calendarEventSchema, calendarEventTimeSchema, clinicAdminOptionsSchema, clinicAdminSchema, clinicAdminSignupSchema, clinicBranchSetupSchema, clinicContactInfoSchema, clinicGroupSchema, clinicGroupSetupSchema, clinicLocationSchema, clinicReviewInfoSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicReviewSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createFilledDocumentDataSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerReviewSchema, createPractitionerSchema, createPractitionerTokenSchema, createProcedureReviewSchema, createReviewSchema, createUserOptionsSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, filledDocumentSchema, filledDocumentStatusSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerSignupSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, procedureReviewInfoSchema, procedureReviewSchema, requesterInfoSchema, requirementInstructionDueNotificationSchema, reviewSchema, searchAppointmentsSchema, searchPatientsSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateFilledDocumentDataSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
package/dist/index.d.ts CHANGED
@@ -362,6 +362,8 @@ interface CertificationRequirement {
362
362
  */
363
363
  declare const DOCUMENTATION_TEMPLATES_COLLECTION = "documentation-templates";
364
364
  declare const FILLED_DOCUMENTS_COLLECTION = "filled-documents";
365
+ declare const USER_FORMS_SUBCOLLECTION = "user-forms";
366
+ declare const DOCTOR_FORMS_SUBCOLLECTION = "doctor-forms";
365
367
  /**
366
368
  * Enum for element types in documentation templates
367
369
  */
@@ -402,17 +404,17 @@ declare enum HeadingLevel {
402
404
  * Enum for dynamic variable placeholders
403
405
  */
404
406
  declare enum DynamicVariable {
405
- PATIENT_NAME = "[PATIENT_NAME]",
406
- DOCTOR_NAME = "[DOCTOR_NAME]",
407
- CLINIC_NAME = "[CLINIC_NAME]",
408
- PATIENT_BIRTHDAY = "[PATIENT_BIRTHDAY]",
409
- APPOINTMENT_DATE = "[APPOINTMENT_DATE]",
410
- CURRENT_DATE = "[CURRENT_DATE]",
411
- PROCEDURE_NAME = "[PROCEDURE_NAME]",
412
- PROCEDURE_DESCRIPTION = "[PROCEDURE_DESCRIPTION]",
413
- PROCEDURE_COST = "[PROCEDURE_COST]",
414
- PROCEDURE_DURATION = "[PROCEDURE_DURATION]",
415
- PROCEDURE_RISK = "[PROCEDURE_RISK]"
407
+ PATIENT_NAME = "$[PATIENT_NAME]",
408
+ DOCTOR_NAME = "$[DOCTOR_NAME]",
409
+ CLINIC_NAME = "$[CLINIC_NAME]",
410
+ PATIENT_BIRTHDAY = "$[PATIENT_BIRTHDAY]",
411
+ APPOINTMENT_DATE = "$[APPOINTMENT_DATE]",
412
+ CURRENT_DATE = "$[CURRENT_DATE]",
413
+ PROCEDURE_NAME = "$[PROCEDURE_NAME]",
414
+ PROCEDURE_DESCRIPTION = "$[PROCEDURE_DESCRIPTION]",
415
+ PROCEDURE_COST = "$[PROCEDURE_COST]",
416
+ PROCEDURE_DURATION = "$[PROCEDURE_DURATION]",
417
+ PROCEDURE_RISK = "$[PROCEDURE_RISK]"
416
418
  }
417
419
  /**
418
420
  * Base interface for all document elements
@@ -516,6 +518,13 @@ interface SignatureElement extends BaseDocumentElement {
516
518
  type: DocumentElementType.SIGNATURE;
517
519
  label: string;
518
520
  }
521
+ /**
522
+ * Interface for digital signature element
523
+ */
524
+ interface DigitalSignatureElement extends BaseDocumentElement {
525
+ type: DocumentElementType.DITIGAL_SIGNATURE;
526
+ label: string;
527
+ }
519
528
  /**
520
529
  * Interface for file upload element
521
530
  */
@@ -6447,6 +6456,15 @@ declare class DocumentationTemplateService extends BaseService {
6447
6456
  templates: DocumentTemplate[];
6448
6457
  lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
6449
6458
  }>;
6459
+ /**
6460
+ * Get all templates for selection with optional filtering
6461
+ * @param options - Filtering options
6462
+ * @returns Array of templates
6463
+ */
6464
+ getAllTemplatesForSelection(options?: {
6465
+ isUserForm?: boolean;
6466
+ isRequired?: boolean;
6467
+ }): Promise<DocumentTemplate[]>;
6450
6468
  }
6451
6469
 
6452
6470
  /**
@@ -19127,4 +19145,4 @@ declare const createReviewSchema: z.ZodEffects<z.ZodObject<{
19127
19145
  } | undefined;
19128
19146
  }>;
19129
19147
 
19130
- export { APPOINTMENTS_COLLECTION, AUTH_ERRORS, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type Appointment, type AppointmentReminderNotification, AppointmentService, AppointmentStatus, AuthError, AuthService, type BaseNotification, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePractitionerData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DOCUMENTATION_TEMPLATES_COLLECTION, type DateRange, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, HeadingLevel, Language, ListType, type LocationData, MedicationAllergySubtype, type Notification, NotificationService, NotificationStatus, NotificationType, 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, PROCEDURES_COLLECTION, type PatientClinic, type PatientDoctor, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsService, type PatientSensitiveInfo, PatientService, PaymentStatus, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RequesterInfo, type Requirement, RequirementType, type Review, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, TechnologyService, type TimeSlot, TimeUnit, TreatmentBenefit, USER_ERRORS, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type ValidationSchema, type VitalStats, type WorkingHours, addAllergySchema, addBlockingConditionSchema, addContraindicationSchema, addMedicationSchema, addressDataSchema, adminInfoSchema, adminTokenSchema, allergySchema, allergySubtypeSchema, appointmentNotificationSchema, appointmentReminderNotificationSchema, baseNotificationSchema, blockingConditionSchema, calendarEventSchema, calendarEventTimeSchema, clinicAdminOptionsSchema, clinicAdminSchema, clinicAdminSignupSchema, clinicBranchSetupSchema, clinicContactInfoSchema, clinicGroupSchema, clinicGroupSetupSchema, clinicLocationSchema, clinicReviewInfoSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicReviewSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createFilledDocumentDataSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerReviewSchema, createPractitionerSchema, createPractitionerTokenSchema, createProcedureReviewSchema, createReviewSchema, createUserOptionsSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, filledDocumentSchema, filledDocumentStatusSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerSignupSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, procedureReviewInfoSchema, procedureReviewSchema, requesterInfoSchema, requirementInstructionDueNotificationSchema, reviewSchema, searchAppointmentsSchema, searchPatientsSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateFilledDocumentDataSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
19148
+ export { APPOINTMENTS_COLLECTION, AUTH_ERRORS, type AddAllergyData, type AddBlockingConditionData, type AddContraindicationData, type AddMedicationData, type AddressData, type AdminInfo, type AdminToken, AdminTokenStatus, type Allergy, type AllergySubtype, AllergyType, type AllergyTypeWithSubtype, type Appointment, type AppointmentReminderNotification, AppointmentService, AppointmentStatus, AuthError, AuthService, type BaseDocumentElement, type BaseNotification, type BinaryChoiceElement, BlockingCondition, type Brand, BrandService, CALENDAR_COLLECTION, CLINICS_COLLECTION, CLINIC_ADMINS_COLLECTION, CLINIC_GROUPS_COLLECTION, type CalendarEvent, CalendarEventStatus, type CalendarEventTime, CalendarEventType, CalendarServiceV2, CalendarSyncStatus, type Category, CategoryService, CertificationLevel, CertificationSpecialty, type Clinic, type ClinicAdmin, ClinicAdminService, type ClinicAdminSignupData, type ClinicBranchSetupData, type ClinicContactInfo, type ClinicGroup, ClinicGroupService, type ClinicGroupSetupData, type ClinicInfo, type ClinicLocation, ClinicPhotoTag, type ClinicReview, type ClinicReviewInfo, ClinicService, ClinicTag, type ClinicTags, type ContactPerson, Contraindication, CosmeticAllergySubtype, type CreateAdminTokenData, type CreateAppointmentData, type CreateAppointmentHttpData, type CreateAppointmentParams, type CreateCalendarEventData, type CreateClinicAdminData, type CreateClinicData, type CreateClinicGroupData, type CreateDefaultClinicGroupData, type CreateDocumentTemplateData, type CreateDraftPractitionerData, type CreatePatientLocationInfoData, type CreatePatientMedicalInfoData, type CreatePatientProfileData, type CreatePatientSensitiveInfoData, type CreatePractitionerData, type CreatePractitionerTokenData, type CreateProcedureData, type CreateSyncedCalendarData, type CreateUserData, Currency, DOCTOR_FORMS_SUBCOLLECTION, DOCUMENTATION_TEMPLATES_COLLECTION, type DatePickerElement, type DateRange, type DigitalSignatureElement, type DoctorInfo, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateService, type DynamicTextElement, DynamicVariable, type EmergencyContact, EnvironmentalAllergySubtype, FILLED_DOCUMENTS_COLLECTION, type FileUploadElement, type FilledDocument, FilledDocumentService, FilledDocumentStatus, FirebaseErrorCode, type FirebaseUser, FoodAllergySubtype, type GamificationInfo, Gender, type HeadingElement, HeadingLevel, Language, type ListElement, ListType, type LocationData, MedicationAllergySubtype, type MultipleChoiceElement, type Notification, NotificationService, NotificationStatus, NotificationType, 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, PROCEDURES_COLLECTION, type ParagraphElement, type PatientClinic, type PatientDoctor, PatientInstructionStatus, type PatientLocationInfo, type PatientMedicalInfo, type PatientProfile, type PatientProfileComplete, type PatientProfileInfo, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsService, type PatientSensitiveInfo, PatientService, PaymentStatus, type PostRequirementNotification, PracticeType, type Practitioner, type PractitionerBasicInfo, type PractitionerCertification, type PractitionerClinicProcedures, type PractitionerClinicWorkingHours, type PractitionerProfileInfo, type PractitionerReview, type PractitionerReviewInfo, PractitionerService, PractitionerStatus, type PractitionerToken, PractitionerTokenStatus, type PractitionerWorkingHours, type PreRequirementNotification, PricingMeasure, type Procedure, type ProcedureCategorization, ProcedureFamily, type ProcedureInfo, type ProcedureReview, type ProcedureReviewInfo, ProcedureService, type Product, ProductService, REGISTER_TOKENS_COLLECTION, REVIEWS_COLLECTION, type RatingScaleElement, type RequesterInfo, type Requirement, RequirementType, type Review, ReviewService, SYNCED_CALENDARS_COLLECTION, type SearchAppointmentsParams, type SearchCalendarEventsParams, SearchLocationEnum, type SearchPatientsParams, type SignatureElement, type SingleChoiceElement, type Subcategory, SubcategoryService, SubscriptionModel, type SyncedCalendar, type SyncedCalendarEvent, SyncedCalendarProvider, SyncedCalendarsService, type Technology, TechnologyService, type TextInputElement, type TimeSlot, TimeUnit, TreatmentBenefit, USER_ERRORS, USER_FORMS_SUBCOLLECTION, type UpdateAllergyData, type UpdateAppointmentData, type UpdateAppointmentParams, type UpdateBlockingConditionData, type UpdateCalendarEventData, type UpdateClinicAdminData, type UpdateClinicData, type UpdateClinicGroupData, type UpdateContraindicationData, type UpdateDocumentTemplateData, type UpdateMedicationData, type UpdatePatientLocationInfoData, type UpdatePatientMedicalInfoData, type UpdatePatientProfileData, type UpdatePatientSensitiveInfoData, type UpdatePractitionerData, type UpdateProcedureData, type UpdateSyncedCalendarData, type UpdateVitalStatsData, type User, UserRole, UserService, type ValidationSchema, type VitalStats, type WorkingHours, addAllergySchema, addBlockingConditionSchema, addContraindicationSchema, addMedicationSchema, addressDataSchema, adminInfoSchema, adminTokenSchema, allergySchema, allergySubtypeSchema, appointmentNotificationSchema, appointmentReminderNotificationSchema, baseNotificationSchema, blockingConditionSchema, calendarEventSchema, calendarEventTimeSchema, clinicAdminOptionsSchema, clinicAdminSchema, clinicAdminSignupSchema, clinicBranchSetupSchema, clinicContactInfoSchema, clinicGroupSchema, clinicGroupSetupSchema, clinicLocationSchema, clinicReviewInfoSchema, clinicReviewSchema, clinicSchema, clinicTagsSchema, contactPersonSchema, contraindicationSchema, createAdminTokenSchema, createAppointmentSchema, createCalendarEventSchema, createClinicAdminSchema, createClinicGroupSchema, createClinicReviewSchema, createClinicSchema, createDefaultClinicGroupSchema, createDocumentTemplateSchema, createDraftPractitionerSchema, createFilledDocumentDataSchema, createPatientLocationInfoSchema, createPatientMedicalInfoSchema, createPatientProfileSchema, createPatientSensitiveInfoSchema, createPractitionerReviewSchema, createPractitionerSchema, createPractitionerTokenSchema, createProcedureReviewSchema, createReviewSchema, createUserOptionsSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, emailSchema, emergencyContactSchema, filledDocumentSchema, filledDocumentStatusSchema, gamificationSchema, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseInstance, initializeFirebase, locationDataSchema, medicationSchema, notificationSchema, passwordSchema, patientClinicSchema, patientDoctorSchema, patientLocationInfoSchema, patientMedicalInfoSchema, patientProfileInfoSchema, patientProfileSchema, patientSensitiveInfoSchema, postRequirementNotificationSchema, practitionerBasicInfoSchema, practitionerCertificationSchema, practitionerClinicWorkingHoursSchema, practitionerProfileInfoSchema, practitionerReviewInfoSchema, practitionerReviewSchema, practitionerSchema, practitionerSignupSchema, practitionerTokenSchema, practitionerWorkingHoursSchema, preRequirementNotificationSchema, procedureCategorizationSchema, procedureInfoSchema, procedureReviewInfoSchema, procedureReviewSchema, requesterInfoSchema, requirementInstructionDueNotificationSchema, reviewSchema, searchAppointmentsSchema, searchPatientsSchema, syncedCalendarEventSchema, timeSlotSchema, timestampSchema, updateAllergySchema, updateAppointmentSchema, updateBlockingConditionSchema, updateCalendarEventSchema, updateClinicAdminSchema, updateClinicGroupSchema, updateClinicSchema, updateContraindicationSchema, updateDocumentTemplateSchema, updateFilledDocumentDataSchema, updateMedicationSchema, updatePatientMedicalInfoSchema, updateVitalStatsSchema, userRoleSchema, userRolesSchema, userSchema, vitalStatsSchema, workingHoursSchema };
package/dist/index.js CHANGED
@@ -58,6 +58,7 @@ __export(index_exports, {
58
58
  Contraindication: () => Contraindication,
59
59
  CosmeticAllergySubtype: () => CosmeticAllergySubtype,
60
60
  Currency: () => Currency,
61
+ DOCTOR_FORMS_SUBCOLLECTION: () => DOCTOR_FORMS_SUBCOLLECTION,
61
62
  DOCUMENTATION_TEMPLATES_COLLECTION: () => DOCUMENTATION_TEMPLATES_COLLECTION,
62
63
  DocumentElementType: () => DocumentElementType,
63
64
  DocumentationTemplateService: () => DocumentationTemplateService,
@@ -112,6 +113,7 @@ __export(index_exports, {
112
113
  TimeUnit: () => TimeUnit,
113
114
  TreatmentBenefit: () => TreatmentBenefit,
114
115
  USER_ERRORS: () => USER_ERRORS,
116
+ USER_FORMS_SUBCOLLECTION: () => USER_FORMS_SUBCOLLECTION,
115
117
  UserService: () => UserService,
116
118
  addAllergySchema: () => addAllergySchema,
117
119
  addBlockingConditionSchema: () => addBlockingConditionSchema,
@@ -305,17 +307,17 @@ var HeadingLevel = /* @__PURE__ */ ((HeadingLevel2) => {
305
307
  return HeadingLevel2;
306
308
  })(HeadingLevel || {});
307
309
  var DynamicVariable = /* @__PURE__ */ ((DynamicVariable2) => {
308
- DynamicVariable2["PATIENT_NAME"] = "[PATIENT_NAME]";
309
- DynamicVariable2["DOCTOR_NAME"] = "[DOCTOR_NAME]";
310
- DynamicVariable2["CLINIC_NAME"] = "[CLINIC_NAME]";
311
- DynamicVariable2["PATIENT_BIRTHDAY"] = "[PATIENT_BIRTHDAY]";
312
- DynamicVariable2["APPOINTMENT_DATE"] = "[APPOINTMENT_DATE]";
313
- DynamicVariable2["CURRENT_DATE"] = "[CURRENT_DATE]";
314
- DynamicVariable2["PROCEDURE_NAME"] = "[PROCEDURE_NAME]";
315
- DynamicVariable2["PROCEDURE_DESCRIPTION"] = "[PROCEDURE_DESCRIPTION]";
316
- DynamicVariable2["PROCEDURE_COST"] = "[PROCEDURE_COST]";
317
- DynamicVariable2["PROCEDURE_DURATION"] = "[PROCEDURE_DURATION]";
318
- DynamicVariable2["PROCEDURE_RISK"] = "[PROCEDURE_RISK]";
310
+ DynamicVariable2["PATIENT_NAME"] = "$[PATIENT_NAME]";
311
+ DynamicVariable2["DOCTOR_NAME"] = "$[DOCTOR_NAME]";
312
+ DynamicVariable2["CLINIC_NAME"] = "$[CLINIC_NAME]";
313
+ DynamicVariable2["PATIENT_BIRTHDAY"] = "$[PATIENT_BIRTHDAY]";
314
+ DynamicVariable2["APPOINTMENT_DATE"] = "$[APPOINTMENT_DATE]";
315
+ DynamicVariable2["CURRENT_DATE"] = "$[CURRENT_DATE]";
316
+ DynamicVariable2["PROCEDURE_NAME"] = "$[PROCEDURE_NAME]";
317
+ DynamicVariable2["PROCEDURE_DESCRIPTION"] = "$[PROCEDURE_DESCRIPTION]";
318
+ DynamicVariable2["PROCEDURE_COST"] = "$[PROCEDURE_COST]";
319
+ DynamicVariable2["PROCEDURE_DURATION"] = "$[PROCEDURE_DURATION]";
320
+ DynamicVariable2["PROCEDURE_RISK"] = "$[PROCEDURE_RISK]";
319
321
  return DynamicVariable2;
320
322
  })(DynamicVariable || {});
321
323
  var FilledDocumentStatus = /* @__PURE__ */ ((FilledDocumentStatus2) => {
@@ -7862,7 +7864,7 @@ var ProcedureService = class extends BaseService {
7862
7864
  preRequirements: technology.requirements.pre,
7863
7865
  postRequirements: technology.requirements.post,
7864
7866
  certificationRequirement: technology.certificationRequirement,
7865
- documentationTemplates: technology.documentationTemplates || [],
7867
+ documentationTemplates: (technology == null ? void 0 : technology.documentationTemplates) || [],
7866
7868
  clinicInfo,
7867
7869
  // Embed aggregated info
7868
7870
  doctorInfo,
@@ -8441,6 +8443,7 @@ var DocumentationTemplateService = class extends BaseService {
8441
8443
  * @returns The updated template
8442
8444
  */
8443
8445
  async updateTemplate(templateId, data) {
8446
+ var _a, _b, _c, _d, _e, _f;
8444
8447
  const validatedData = updateDocumentTemplateSchema.parse(data);
8445
8448
  const template = await this.getTemplateById(templateId);
8446
8449
  if (!template) {
@@ -8466,12 +8469,9 @@ var DocumentationTemplateService = class extends BaseService {
8466
8469
  updatePayload.isActive = validatedData.isActive;
8467
8470
  if (validatedData.tags !== void 0)
8468
8471
  updatePayload.tags = validatedData.tags;
8469
- if (validatedData.isUserForm !== void 0)
8470
- updatePayload.isUserForm = validatedData.isUserForm;
8471
- if (validatedData.isRequired !== void 0)
8472
- updatePayload.isRequired = validatedData.isRequired;
8473
- if (validatedData.sortingOrder !== void 0)
8474
- updatePayload.sortingOrder = validatedData.sortingOrder;
8472
+ updatePayload.isUserForm = (_b = (_a = validatedData.isUserForm) != null ? _a : template.isUserForm) != null ? _b : false;
8473
+ updatePayload.isRequired = (_d = (_c = validatedData.isRequired) != null ? _c : template.isRequired) != null ? _d : false;
8474
+ updatePayload.sortingOrder = (_f = (_e = validatedData.sortingOrder) != null ? _e : template.sortingOrder) != null ? _f : 0;
8475
8475
  const docRef = (0, import_firestore25.doc)(this.collectionRef, templateId);
8476
8476
  await (0, import_firestore25.updateDoc)(docRef, updatePayload);
8477
8477
  return { ...template, ...updatePayload };
@@ -8571,6 +8571,30 @@ var DocumentationTemplateService = class extends BaseService {
8571
8571
  lastDoc: lastVisible
8572
8572
  };
8573
8573
  }
8574
+ /**
8575
+ * Get all templates for selection with optional filtering
8576
+ * @param options - Filtering options
8577
+ * @returns Array of templates
8578
+ */
8579
+ async getAllTemplatesForSelection(options) {
8580
+ let q = (0, import_firestore25.query)(
8581
+ this.collectionRef,
8582
+ (0, import_firestore25.where)("isActive", "==", true),
8583
+ (0, import_firestore25.orderBy)("updatedAt", "desc")
8584
+ );
8585
+ if ((options == null ? void 0 : options.isUserForm) !== void 0) {
8586
+ q = (0, import_firestore25.query)(q, (0, import_firestore25.where)("isUserForm", "==", options.isUserForm));
8587
+ }
8588
+ if ((options == null ? void 0 : options.isRequired) !== void 0) {
8589
+ q = (0, import_firestore25.query)(q, (0, import_firestore25.where)("isRequired", "==", options.isRequired));
8590
+ }
8591
+ const querySnapshot = await (0, import_firestore25.getDocs)(q);
8592
+ const templates = [];
8593
+ querySnapshot.forEach((doc33) => {
8594
+ templates.push(doc33.data());
8595
+ });
8596
+ return templates;
8597
+ }
8574
8598
  };
8575
8599
 
8576
8600
  // src/services/documentation-templates/filled-document.service.ts
@@ -14337,6 +14361,7 @@ var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
14337
14361
  Contraindication,
14338
14362
  CosmeticAllergySubtype,
14339
14363
  Currency,
14364
+ DOCTOR_FORMS_SUBCOLLECTION,
14340
14365
  DOCUMENTATION_TEMPLATES_COLLECTION,
14341
14366
  DocumentElementType,
14342
14367
  DocumentationTemplateService,
@@ -14391,6 +14416,7 @@ var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
14391
14416
  TimeUnit,
14392
14417
  TreatmentBenefit,
14393
14418
  USER_ERRORS,
14419
+ USER_FORMS_SUBCOLLECTION,
14394
14420
  UserService,
14395
14421
  addAllergySchema,
14396
14422
  addBlockingConditionSchema,
package/dist/index.mjs CHANGED
@@ -71,17 +71,17 @@ var HeadingLevel = /* @__PURE__ */ ((HeadingLevel2) => {
71
71
  return HeadingLevel2;
72
72
  })(HeadingLevel || {});
73
73
  var DynamicVariable = /* @__PURE__ */ ((DynamicVariable2) => {
74
- DynamicVariable2["PATIENT_NAME"] = "[PATIENT_NAME]";
75
- DynamicVariable2["DOCTOR_NAME"] = "[DOCTOR_NAME]";
76
- DynamicVariable2["CLINIC_NAME"] = "[CLINIC_NAME]";
77
- DynamicVariable2["PATIENT_BIRTHDAY"] = "[PATIENT_BIRTHDAY]";
78
- DynamicVariable2["APPOINTMENT_DATE"] = "[APPOINTMENT_DATE]";
79
- DynamicVariable2["CURRENT_DATE"] = "[CURRENT_DATE]";
80
- DynamicVariable2["PROCEDURE_NAME"] = "[PROCEDURE_NAME]";
81
- DynamicVariable2["PROCEDURE_DESCRIPTION"] = "[PROCEDURE_DESCRIPTION]";
82
- DynamicVariable2["PROCEDURE_COST"] = "[PROCEDURE_COST]";
83
- DynamicVariable2["PROCEDURE_DURATION"] = "[PROCEDURE_DURATION]";
84
- DynamicVariable2["PROCEDURE_RISK"] = "[PROCEDURE_RISK]";
74
+ DynamicVariable2["PATIENT_NAME"] = "$[PATIENT_NAME]";
75
+ DynamicVariable2["DOCTOR_NAME"] = "$[DOCTOR_NAME]";
76
+ DynamicVariable2["CLINIC_NAME"] = "$[CLINIC_NAME]";
77
+ DynamicVariable2["PATIENT_BIRTHDAY"] = "$[PATIENT_BIRTHDAY]";
78
+ DynamicVariable2["APPOINTMENT_DATE"] = "$[APPOINTMENT_DATE]";
79
+ DynamicVariable2["CURRENT_DATE"] = "$[CURRENT_DATE]";
80
+ DynamicVariable2["PROCEDURE_NAME"] = "$[PROCEDURE_NAME]";
81
+ DynamicVariable2["PROCEDURE_DESCRIPTION"] = "$[PROCEDURE_DESCRIPTION]";
82
+ DynamicVariable2["PROCEDURE_COST"] = "$[PROCEDURE_COST]";
83
+ DynamicVariable2["PROCEDURE_DURATION"] = "$[PROCEDURE_DURATION]";
84
+ DynamicVariable2["PROCEDURE_RISK"] = "$[PROCEDURE_RISK]";
85
85
  return DynamicVariable2;
86
86
  })(DynamicVariable || {});
87
87
  var FilledDocumentStatus = /* @__PURE__ */ ((FilledDocumentStatus2) => {
@@ -7839,7 +7839,7 @@ var ProcedureService = class extends BaseService {
7839
7839
  preRequirements: technology.requirements.pre,
7840
7840
  postRequirements: technology.requirements.post,
7841
7841
  certificationRequirement: technology.certificationRequirement,
7842
- documentationTemplates: technology.documentationTemplates || [],
7842
+ documentationTemplates: (technology == null ? void 0 : technology.documentationTemplates) || [],
7843
7843
  clinicInfo,
7844
7844
  // Embed aggregated info
7845
7845
  doctorInfo,
@@ -8431,6 +8431,7 @@ var DocumentationTemplateService = class extends BaseService {
8431
8431
  * @returns The updated template
8432
8432
  */
8433
8433
  async updateTemplate(templateId, data) {
8434
+ var _a, _b, _c, _d, _e, _f;
8434
8435
  const validatedData = updateDocumentTemplateSchema.parse(data);
8435
8436
  const template = await this.getTemplateById(templateId);
8436
8437
  if (!template) {
@@ -8456,12 +8457,9 @@ var DocumentationTemplateService = class extends BaseService {
8456
8457
  updatePayload.isActive = validatedData.isActive;
8457
8458
  if (validatedData.tags !== void 0)
8458
8459
  updatePayload.tags = validatedData.tags;
8459
- if (validatedData.isUserForm !== void 0)
8460
- updatePayload.isUserForm = validatedData.isUserForm;
8461
- if (validatedData.isRequired !== void 0)
8462
- updatePayload.isRequired = validatedData.isRequired;
8463
- if (validatedData.sortingOrder !== void 0)
8464
- updatePayload.sortingOrder = validatedData.sortingOrder;
8460
+ updatePayload.isUserForm = (_b = (_a = validatedData.isUserForm) != null ? _a : template.isUserForm) != null ? _b : false;
8461
+ updatePayload.isRequired = (_d = (_c = validatedData.isRequired) != null ? _c : template.isRequired) != null ? _d : false;
8462
+ updatePayload.sortingOrder = (_f = (_e = validatedData.sortingOrder) != null ? _e : template.sortingOrder) != null ? _f : 0;
8465
8463
  const docRef = doc16(this.collectionRef, templateId);
8466
8464
  await updateDoc16(docRef, updatePayload);
8467
8465
  return { ...template, ...updatePayload };
@@ -8561,6 +8559,30 @@ var DocumentationTemplateService = class extends BaseService {
8561
8559
  lastDoc: lastVisible
8562
8560
  };
8563
8561
  }
8562
+ /**
8563
+ * Get all templates for selection with optional filtering
8564
+ * @param options - Filtering options
8565
+ * @returns Array of templates
8566
+ */
8567
+ async getAllTemplatesForSelection(options) {
8568
+ let q = query16(
8569
+ this.collectionRef,
8570
+ where16("isActive", "==", true),
8571
+ orderBy5("updatedAt", "desc")
8572
+ );
8573
+ if ((options == null ? void 0 : options.isUserForm) !== void 0) {
8574
+ q = query16(q, where16("isUserForm", "==", options.isUserForm));
8575
+ }
8576
+ if ((options == null ? void 0 : options.isRequired) !== void 0) {
8577
+ q = query16(q, where16("isRequired", "==", options.isRequired));
8578
+ }
8579
+ const querySnapshot = await getDocs16(q);
8580
+ const templates = [];
8581
+ querySnapshot.forEach((doc33) => {
8582
+ templates.push(doc33.data());
8583
+ });
8584
+ return templates;
8585
+ }
8564
8586
  };
8565
8587
 
8566
8588
  // src/services/documentation-templates/filled-document.service.ts
@@ -14504,6 +14526,7 @@ export {
14504
14526
  Contraindication,
14505
14527
  CosmeticAllergySubtype,
14506
14528
  Currency,
14529
+ DOCTOR_FORMS_SUBCOLLECTION,
14507
14530
  DOCUMENTATION_TEMPLATES_COLLECTION,
14508
14531
  DocumentElementType,
14509
14532
  DocumentationTemplateService,
@@ -14558,6 +14581,7 @@ export {
14558
14581
  TimeUnit,
14559
14582
  TreatmentBenefit,
14560
14583
  USER_ERRORS,
14584
+ USER_FORMS_SUBCOLLECTION,
14561
14585
  UserService,
14562
14586
  addAllergySchema,
14563
14587
  addBlockingConditionSchema,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.6.21",
4
+ "version": "1.6.22",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
package/src/index.ts CHANGED
@@ -299,6 +299,20 @@ export type {
299
299
  UpdateDocumentTemplateData,
300
300
  DocumentElement,
301
301
  FilledDocument,
302
+ BaseDocumentElement,
303
+ HeadingElement,
304
+ ParagraphElement,
305
+ ListElement,
306
+ DynamicTextElement,
307
+ BinaryChoiceElement,
308
+ MultipleChoiceElement,
309
+ SingleChoiceElement,
310
+ RatingScaleElement,
311
+ TextInputElement,
312
+ DatePickerElement,
313
+ SignatureElement,
314
+ DigitalSignatureElement,
315
+ FileUploadElement,
302
316
  } from "./types/documentation-templates";
303
317
  export {
304
318
  DocumentElementType,
@@ -306,11 +320,11 @@ export {
306
320
  ListType,
307
321
  DynamicVariable,
308
322
  FilledDocumentStatus,
309
- } from "./types/documentation-templates";
310
- export {
311
323
  DOCUMENTATION_TEMPLATES_COLLECTION,
312
324
  FILLED_DOCUMENTS_COLLECTION,
313
- } from "./types";
325
+ USER_FORMS_SUBCOLLECTION,
326
+ DOCTOR_FORMS_SUBCOLLECTION,
327
+ } from "./types/documentation-templates";
314
328
 
315
329
  // Procedure types
316
330
  export type {
@@ -144,12 +144,14 @@ export class DocumentationTemplateService extends BaseService {
144
144
  updatePayload.isActive = validatedData.isActive;
145
145
  if (validatedData.tags !== undefined)
146
146
  updatePayload.tags = validatedData.tags;
147
- if (validatedData.isUserForm !== undefined)
148
- updatePayload.isUserForm = validatedData.isUserForm;
149
- if (validatedData.isRequired !== undefined)
150
- updatePayload.isRequired = validatedData.isRequired;
151
- if (validatedData.sortingOrder !== undefined)
152
- updatePayload.sortingOrder = validatedData.sortingOrder;
147
+
148
+ // Always include these properties with defaults if they're missing
149
+ updatePayload.isUserForm =
150
+ validatedData.isUserForm ?? template.isUserForm ?? false;
151
+ updatePayload.isRequired =
152
+ validatedData.isRequired ?? template.isRequired ?? false;
153
+ updatePayload.sortingOrder =
154
+ validatedData.sortingOrder ?? template.sortingOrder ?? 0;
153
155
 
154
156
  const docRef = doc(this.collectionRef, templateId);
155
157
  await updateDoc(docRef, updatePayload);
@@ -287,4 +289,37 @@ export class DocumentationTemplateService extends BaseService {
287
289
  lastDoc: lastVisible,
288
290
  };
289
291
  }
292
+
293
+ /**
294
+ * Get all templates for selection with optional filtering
295
+ * @param options - Filtering options
296
+ * @returns Array of templates
297
+ */
298
+ async getAllTemplatesForSelection(options?: {
299
+ isUserForm?: boolean;
300
+ isRequired?: boolean;
301
+ }): Promise<DocumentTemplate[]> {
302
+ let q = query(
303
+ this.collectionRef,
304
+ where("isActive", "==", true),
305
+ orderBy("updatedAt", "desc")
306
+ );
307
+
308
+ if (options?.isUserForm !== undefined) {
309
+ q = query(q, where("isUserForm", "==", options.isUserForm));
310
+ }
311
+
312
+ if (options?.isRequired !== undefined) {
313
+ q = query(q, where("isRequired", "==", options.isRequired));
314
+ }
315
+
316
+ const querySnapshot = await getDocs(q);
317
+ const templates: DocumentTemplate[] = [];
318
+
319
+ querySnapshot.forEach((doc) => {
320
+ templates.push(doc.data() as DocumentTemplate);
321
+ });
322
+
323
+ return templates;
324
+ }
290
325
  }
@@ -184,7 +184,7 @@ export class ProcedureService extends BaseService {
184
184
  preRequirements: technology.requirements.pre,
185
185
  postRequirements: technology.requirements.post,
186
186
  certificationRequirement: technology.certificationRequirement,
187
- documentationTemplates: technology.documentationTemplates || [],
187
+ documentationTemplates: technology?.documentationTemplates || [],
188
188
  clinicInfo, // Embed aggregated info
189
189
  doctorInfo, // Embed aggregated info
190
190
  reviewInfo: {
@@ -57,17 +57,17 @@ export enum HeadingLevel {
57
57
  * Enum for dynamic variable placeholders
58
58
  */
59
59
  export enum DynamicVariable {
60
- PATIENT_NAME = "[PATIENT_NAME]",
61
- DOCTOR_NAME = "[DOCTOR_NAME]",
62
- CLINIC_NAME = "[CLINIC_NAME]",
63
- PATIENT_BIRTHDAY = "[PATIENT_BIRTHDAY]",
64
- APPOINTMENT_DATE = "[APPOINTMENT_DATE]",
65
- CURRENT_DATE = "[CURRENT_DATE]",
66
- PROCEDURE_NAME = "[PROCEDURE_NAME]",
67
- PROCEDURE_DESCRIPTION = "[PROCEDURE_DESCRIPTION]",
68
- PROCEDURE_COST = "[PROCEDURE_COST]",
69
- PROCEDURE_DURATION = "[PROCEDURE_DURATION]",
70
- PROCEDURE_RISK = "[PROCEDURE_RISK]",
60
+ PATIENT_NAME = "$[PATIENT_NAME]",
61
+ DOCTOR_NAME = "$[DOCTOR_NAME]",
62
+ CLINIC_NAME = "$[CLINIC_NAME]",
63
+ PATIENT_BIRTHDAY = "$[PATIENT_BIRTHDAY]",
64
+ APPOINTMENT_DATE = "$[APPOINTMENT_DATE]",
65
+ CURRENT_DATE = "$[CURRENT_DATE]",
66
+ PROCEDURE_NAME = "$[PROCEDURE_NAME]",
67
+ PROCEDURE_DESCRIPTION = "$[PROCEDURE_DESCRIPTION]",
68
+ PROCEDURE_COST = "$[PROCEDURE_COST]",
69
+ PROCEDURE_DURATION = "$[PROCEDURE_DURATION]",
70
+ PROCEDURE_RISK = "$[PROCEDURE_RISK]",
71
71
  }
72
72
 
73
73
  /**