@blackcode_sa/metaestetics-api 1.6.21 → 1.6.23

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,7 +1628,9 @@ var DocumentationTemplateService = class extends BaseService {
1628
1628
  * @returns The updated template
1629
1629
  */
1630
1630
  async updateTemplate(templateId, data) {
1631
+ var _a, _b, _c;
1631
1632
  const validatedData = updateDocumentTemplateSchema.parse(data);
1633
+ console.log("Validated data", validatedData);
1632
1634
  const template = await this.getTemplateById(templateId);
1633
1635
  if (!template) {
1634
1636
  throw new Error(`Template with ID ${templateId} not found`);
@@ -1653,13 +1655,11 @@ var DocumentationTemplateService = class extends BaseService {
1653
1655
  updatePayload.isActive = validatedData.isActive;
1654
1656
  if (validatedData.tags !== void 0)
1655
1657
  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;
1658
+ updatePayload.isUserForm = (_a = validatedData.isUserForm) != null ? _a : false;
1659
+ updatePayload.isRequired = (_b = validatedData.isRequired) != null ? _b : false;
1660
+ updatePayload.sortingOrder = (_c = validatedData.sortingOrder) != null ? _c : 0;
1662
1661
  const docRef = (0, import_firestore7.doc)(this.collectionRef, templateId);
1662
+ console.log("Update payload", updatePayload);
1663
1663
  await (0, import_firestore7.updateDoc)(docRef, updatePayload);
1664
1664
  return { ...template, ...updatePayload };
1665
1665
  }
@@ -1758,6 +1758,30 @@ var DocumentationTemplateService = class extends BaseService {
1758
1758
  lastDoc: lastVisible
1759
1759
  };
1760
1760
  }
1761
+ /**
1762
+ * Get all templates for selection with optional filtering
1763
+ * @param options - Filtering options
1764
+ * @returns Array of templates
1765
+ */
1766
+ async getAllTemplatesForSelection(options) {
1767
+ let q = (0, import_firestore7.query)(
1768
+ this.collectionRef,
1769
+ (0, import_firestore7.where)("isActive", "==", true),
1770
+ (0, import_firestore7.orderBy)("updatedAt", "desc")
1771
+ );
1772
+ if ((options == null ? void 0 : options.isUserForm) !== void 0) {
1773
+ q = (0, import_firestore7.query)(q, (0, import_firestore7.where)("isUserForm", "==", options.isUserForm));
1774
+ }
1775
+ if ((options == null ? void 0 : options.isRequired) !== void 0) {
1776
+ q = (0, import_firestore7.query)(q, (0, import_firestore7.where)("isRequired", "==", options.isRequired));
1777
+ }
1778
+ const querySnapshot = await (0, import_firestore7.getDocs)(q);
1779
+ const templates = [];
1780
+ querySnapshot.forEach((doc9) => {
1781
+ templates.push(doc9.data());
1782
+ });
1783
+ return templates;
1784
+ }
1761
1785
  };
1762
1786
 
1763
1787
  // 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,7 +1605,9 @@ var DocumentationTemplateService = class extends BaseService {
1605
1605
  * @returns The updated template
1606
1606
  */
1607
1607
  async updateTemplate(templateId, data) {
1608
+ var _a, _b, _c;
1608
1609
  const validatedData = updateDocumentTemplateSchema.parse(data);
1610
+ console.log("Validated data", validatedData);
1609
1611
  const template = await this.getTemplateById(templateId);
1610
1612
  if (!template) {
1611
1613
  throw new Error(`Template with ID ${templateId} not found`);
@@ -1630,13 +1632,11 @@ var DocumentationTemplateService = class extends BaseService {
1630
1632
  updatePayload.isActive = validatedData.isActive;
1631
1633
  if (validatedData.tags !== void 0)
1632
1634
  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;
1635
+ updatePayload.isUserForm = (_a = validatedData.isUserForm) != null ? _a : false;
1636
+ updatePayload.isRequired = (_b = validatedData.isRequired) != null ? _b : false;
1637
+ updatePayload.sortingOrder = (_c = validatedData.sortingOrder) != null ? _c : 0;
1639
1638
  const docRef = doc7(this.collectionRef, templateId);
1639
+ console.log("Update payload", updatePayload);
1640
1640
  await updateDoc7(docRef, updatePayload);
1641
1641
  return { ...template, ...updatePayload };
1642
1642
  }
@@ -1735,6 +1735,30 @@ var DocumentationTemplateService = class extends BaseService {
1735
1735
  lastDoc: lastVisible
1736
1736
  };
1737
1737
  }
1738
+ /**
1739
+ * Get all templates for selection with optional filtering
1740
+ * @param options - Filtering options
1741
+ * @returns Array of templates
1742
+ */
1743
+ async getAllTemplatesForSelection(options) {
1744
+ let q = query7(
1745
+ this.collectionRef,
1746
+ where7("isActive", "==", true),
1747
+ orderBy("updatedAt", "desc")
1748
+ );
1749
+ if ((options == null ? void 0 : options.isUserForm) !== void 0) {
1750
+ q = query7(q, where7("isUserForm", "==", options.isUserForm));
1751
+ }
1752
+ if ((options == null ? void 0 : options.isRequired) !== void 0) {
1753
+ q = query7(q, where7("isRequired", "==", options.isRequired));
1754
+ }
1755
+ const querySnapshot = await getDocs7(q);
1756
+ const templates = [];
1757
+ querySnapshot.forEach((doc9) => {
1758
+ templates.push(doc9.data());
1759
+ });
1760
+ return templates;
1761
+ }
1738
1762
  };
1739
1763
 
1740
1764
  // 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,7 +8443,9 @@ var DocumentationTemplateService = class extends BaseService {
8441
8443
  * @returns The updated template
8442
8444
  */
8443
8445
  async updateTemplate(templateId, data) {
8446
+ var _a, _b, _c;
8444
8447
  const validatedData = updateDocumentTemplateSchema.parse(data);
8448
+ console.log("Validated data", validatedData);
8445
8449
  const template = await this.getTemplateById(templateId);
8446
8450
  if (!template) {
8447
8451
  throw new Error(`Template with ID ${templateId} not found`);
@@ -8466,13 +8470,11 @@ var DocumentationTemplateService = class extends BaseService {
8466
8470
  updatePayload.isActive = validatedData.isActive;
8467
8471
  if (validatedData.tags !== void 0)
8468
8472
  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;
8473
+ updatePayload.isUserForm = (_a = validatedData.isUserForm) != null ? _a : false;
8474
+ updatePayload.isRequired = (_b = validatedData.isRequired) != null ? _b : false;
8475
+ updatePayload.sortingOrder = (_c = validatedData.sortingOrder) != null ? _c : 0;
8475
8476
  const docRef = (0, import_firestore25.doc)(this.collectionRef, templateId);
8477
+ console.log("Update payload", updatePayload);
8476
8478
  await (0, import_firestore25.updateDoc)(docRef, updatePayload);
8477
8479
  return { ...template, ...updatePayload };
8478
8480
  }
@@ -8571,6 +8573,30 @@ var DocumentationTemplateService = class extends BaseService {
8571
8573
  lastDoc: lastVisible
8572
8574
  };
8573
8575
  }
8576
+ /**
8577
+ * Get all templates for selection with optional filtering
8578
+ * @param options - Filtering options
8579
+ * @returns Array of templates
8580
+ */
8581
+ async getAllTemplatesForSelection(options) {
8582
+ let q = (0, import_firestore25.query)(
8583
+ this.collectionRef,
8584
+ (0, import_firestore25.where)("isActive", "==", true),
8585
+ (0, import_firestore25.orderBy)("updatedAt", "desc")
8586
+ );
8587
+ if ((options == null ? void 0 : options.isUserForm) !== void 0) {
8588
+ q = (0, import_firestore25.query)(q, (0, import_firestore25.where)("isUserForm", "==", options.isUserForm));
8589
+ }
8590
+ if ((options == null ? void 0 : options.isRequired) !== void 0) {
8591
+ q = (0, import_firestore25.query)(q, (0, import_firestore25.where)("isRequired", "==", options.isRequired));
8592
+ }
8593
+ const querySnapshot = await (0, import_firestore25.getDocs)(q);
8594
+ const templates = [];
8595
+ querySnapshot.forEach((doc33) => {
8596
+ templates.push(doc33.data());
8597
+ });
8598
+ return templates;
8599
+ }
8574
8600
  };
8575
8601
 
8576
8602
  // src/services/documentation-templates/filled-document.service.ts
@@ -14337,6 +14363,7 @@ var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
14337
14363
  Contraindication,
14338
14364
  CosmeticAllergySubtype,
14339
14365
  Currency,
14366
+ DOCTOR_FORMS_SUBCOLLECTION,
14340
14367
  DOCUMENTATION_TEMPLATES_COLLECTION,
14341
14368
  DocumentElementType,
14342
14369
  DocumentationTemplateService,
@@ -14391,6 +14418,7 @@ var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
14391
14418
  TimeUnit,
14392
14419
  TreatmentBenefit,
14393
14420
  USER_ERRORS,
14421
+ USER_FORMS_SUBCOLLECTION,
14394
14422
  UserService,
14395
14423
  addAllergySchema,
14396
14424
  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,7 +8431,9 @@ var DocumentationTemplateService = class extends BaseService {
8431
8431
  * @returns The updated template
8432
8432
  */
8433
8433
  async updateTemplate(templateId, data) {
8434
+ var _a, _b, _c;
8434
8435
  const validatedData = updateDocumentTemplateSchema.parse(data);
8436
+ console.log("Validated data", validatedData);
8435
8437
  const template = await this.getTemplateById(templateId);
8436
8438
  if (!template) {
8437
8439
  throw new Error(`Template with ID ${templateId} not found`);
@@ -8456,13 +8458,11 @@ var DocumentationTemplateService = class extends BaseService {
8456
8458
  updatePayload.isActive = validatedData.isActive;
8457
8459
  if (validatedData.tags !== void 0)
8458
8460
  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;
8461
+ updatePayload.isUserForm = (_a = validatedData.isUserForm) != null ? _a : false;
8462
+ updatePayload.isRequired = (_b = validatedData.isRequired) != null ? _b : false;
8463
+ updatePayload.sortingOrder = (_c = validatedData.sortingOrder) != null ? _c : 0;
8465
8464
  const docRef = doc16(this.collectionRef, templateId);
8465
+ console.log("Update payload", updatePayload);
8466
8466
  await updateDoc16(docRef, updatePayload);
8467
8467
  return { ...template, ...updatePayload };
8468
8468
  }
@@ -8561,6 +8561,30 @@ var DocumentationTemplateService = class extends BaseService {
8561
8561
  lastDoc: lastVisible
8562
8562
  };
8563
8563
  }
8564
+ /**
8565
+ * Get all templates for selection with optional filtering
8566
+ * @param options - Filtering options
8567
+ * @returns Array of templates
8568
+ */
8569
+ async getAllTemplatesForSelection(options) {
8570
+ let q = query16(
8571
+ this.collectionRef,
8572
+ where16("isActive", "==", true),
8573
+ orderBy5("updatedAt", "desc")
8574
+ );
8575
+ if ((options == null ? void 0 : options.isUserForm) !== void 0) {
8576
+ q = query16(q, where16("isUserForm", "==", options.isUserForm));
8577
+ }
8578
+ if ((options == null ? void 0 : options.isRequired) !== void 0) {
8579
+ q = query16(q, where16("isRequired", "==", options.isRequired));
8580
+ }
8581
+ const querySnapshot = await getDocs16(q);
8582
+ const templates = [];
8583
+ querySnapshot.forEach((doc33) => {
8584
+ templates.push(doc33.data());
8585
+ });
8586
+ return templates;
8587
+ }
8564
8588
  };
8565
8589
 
8566
8590
  // src/services/documentation-templates/filled-document.service.ts
@@ -14504,6 +14528,7 @@ export {
14504
14528
  Contraindication,
14505
14529
  CosmeticAllergySubtype,
14506
14530
  Currency,
14531
+ DOCTOR_FORMS_SUBCOLLECTION,
14507
14532
  DOCUMENTATION_TEMPLATES_COLLECTION,
14508
14533
  DocumentElementType,
14509
14534
  DocumentationTemplateService,
@@ -14558,6 +14583,7 @@ export {
14558
14583
  TimeUnit,
14559
14584
  TreatmentBenefit,
14560
14585
  USER_ERRORS,
14586
+ USER_FORMS_SUBCOLLECTION,
14561
14587
  UserService,
14562
14588
  addAllergySchema,
14563
14589
  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.23",
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 {
@@ -113,6 +113,7 @@ export class DocumentationTemplateService extends BaseService {
113
113
  ): Promise<DocumentTemplate> {
114
114
  // Validate data
115
115
  const validatedData = updateDocumentTemplateSchema.parse(data);
116
+ console.log("Validated data", validatedData);
116
117
 
117
118
  // Get existing template
118
119
  const template = await this.getTemplateById(templateId);
@@ -144,14 +145,14 @@ export class DocumentationTemplateService extends BaseService {
144
145
  updatePayload.isActive = validatedData.isActive;
145
146
  if (validatedData.tags !== undefined)
146
147
  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;
148
+
149
+ // Always include these properties with defaults if they're missing
150
+ updatePayload.isUserForm = validatedData.isUserForm ?? false;
151
+ updatePayload.isRequired = validatedData.isRequired ?? false;
152
+ updatePayload.sortingOrder = validatedData.sortingOrder ?? 0;
153
153
 
154
154
  const docRef = doc(this.collectionRef, templateId);
155
+ console.log("Update payload", updatePayload);
155
156
  await updateDoc(docRef, updatePayload);
156
157
 
157
158
  return { ...template, ...updatePayload } as DocumentTemplate;
@@ -287,4 +288,37 @@ export class DocumentationTemplateService extends BaseService {
287
288
  lastDoc: lastVisible,
288
289
  };
289
290
  }
291
+
292
+ /**
293
+ * Get all templates for selection with optional filtering
294
+ * @param options - Filtering options
295
+ * @returns Array of templates
296
+ */
297
+ async getAllTemplatesForSelection(options?: {
298
+ isUserForm?: boolean;
299
+ isRequired?: boolean;
300
+ }): Promise<DocumentTemplate[]> {
301
+ let q = query(
302
+ this.collectionRef,
303
+ where("isActive", "==", true),
304
+ orderBy("updatedAt", "desc")
305
+ );
306
+
307
+ if (options?.isUserForm !== undefined) {
308
+ q = query(q, where("isUserForm", "==", options.isUserForm));
309
+ }
310
+
311
+ if (options?.isRequired !== undefined) {
312
+ q = query(q, where("isRequired", "==", options.isRequired));
313
+ }
314
+
315
+ const querySnapshot = await getDocs(q);
316
+ const templates: DocumentTemplate[] = [];
317
+
318
+ querySnapshot.forEach((doc) => {
319
+ templates.push(doc.data() as DocumentTemplate);
320
+ });
321
+
322
+ return templates;
323
+ }
290
324
  }
@@ -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
  /**