@blackcode_sa/metaestetics-api 1.14.46 → 1.14.49

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.
@@ -1711,6 +1711,7 @@ interface ZoneItemData {
1711
1711
  parentZone: string;
1712
1712
  subzones: string[];
1713
1713
  notes?: string;
1714
+ notesVisibleToPatient?: boolean;
1714
1715
  subtotal?: number;
1715
1716
  ionNumber?: string;
1716
1717
  createdAt?: string;
@@ -1711,6 +1711,7 @@ interface ZoneItemData {
1711
1711
  parentZone: string;
1712
1712
  subzones: string[];
1713
1713
  notes?: string;
1714
+ notesVisibleToPatient?: boolean;
1714
1715
  subtotal?: number;
1715
1716
  ionNumber?: string;
1716
1717
  createdAt?: string;
package/dist/index.d.mts CHANGED
@@ -5648,6 +5648,7 @@ interface ZoneItemData {
5648
5648
  parentZone: string;
5649
5649
  subzones: string[];
5650
5650
  notes?: string;
5651
+ notesVisibleToPatient?: boolean;
5651
5652
  subtotal?: number;
5652
5653
  ionNumber?: string;
5653
5654
  createdAt?: string;
@@ -7735,6 +7736,16 @@ declare class AppointmentService extends BaseService {
7735
7736
  * @returns The updated appointment
7736
7737
  */
7737
7738
  updateZonePhotoNoteVisibility(appointmentId: string, zoneId: string, photoIndex: number, noteType: 'before' | 'after', visibleToPatient: boolean, doctorId: string): Promise<Appointment>;
7739
+ /**
7740
+ * Updates visibility of notes for a zone item (product or standalone note)
7741
+ *
7742
+ * @param appointmentId ID of the appointment
7743
+ * @param zoneId Zone ID
7744
+ * @param itemIndex Index of the item in the zone
7745
+ * @param notesVisibleToPatient Whether the notes should be visible to patient
7746
+ * @returns The updated appointment
7747
+ */
7748
+ updateZoneItemNoteVisibility(appointmentId: string, zoneId: string, itemIndex: number, notesVisibleToPatient: boolean): Promise<Appointment>;
7738
7749
  /**
7739
7750
  * Gets a specific photo entry from a zone
7740
7751
  *
package/dist/index.d.ts CHANGED
@@ -5648,6 +5648,7 @@ interface ZoneItemData {
5648
5648
  parentZone: string;
5649
5649
  subzones: string[];
5650
5650
  notes?: string;
5651
+ notesVisibleToPatient?: boolean;
5651
5652
  subtotal?: number;
5652
5653
  ionNumber?: string;
5653
5654
  createdAt?: string;
@@ -7735,6 +7736,16 @@ declare class AppointmentService extends BaseService {
7735
7736
  * @returns The updated appointment
7736
7737
  */
7737
7738
  updateZonePhotoNoteVisibility(appointmentId: string, zoneId: string, photoIndex: number, noteType: 'before' | 'after', visibleToPatient: boolean, doctorId: string): Promise<Appointment>;
7739
+ /**
7740
+ * Updates visibility of notes for a zone item (product or standalone note)
7741
+ *
7742
+ * @param appointmentId ID of the appointment
7743
+ * @param zoneId Zone ID
7744
+ * @param itemIndex Index of the item in the zone
7745
+ * @param notesVisibleToPatient Whether the notes should be visible to patient
7746
+ * @returns The updated appointment
7747
+ */
7748
+ updateZoneItemNoteVisibility(appointmentId: string, zoneId: string, itemIndex: number, notesVisibleToPatient: boolean): Promise<Appointment>;
7738
7749
  /**
7739
7750
  * Gets a specific photo entry from a zone
7740
7751
  *
package/dist/index.js CHANGED
@@ -5362,7 +5362,8 @@ function addVisibilityAudit(updates, doctorId) {
5362
5362
  if (updates.showToPatient !== void 0 || updates.beforeNoteVisibleToPatient !== void 0 || updates.afterNoteVisibleToPatient !== void 0) {
5363
5363
  return {
5364
5364
  ...updates,
5365
- visibilityUpdatedAt: (0, import_firestore13.serverTimestamp)(),
5365
+ visibilityUpdatedAt: import_firestore13.Timestamp.now(),
5366
+ // Use client-side timestamp (Firestore limitation)
5366
5367
  visibilityUpdatedBy: doctorId
5367
5368
  };
5368
5369
  }
@@ -7004,6 +7005,28 @@ var AppointmentService = class extends BaseService {
7004
7005
  throw error;
7005
7006
  }
7006
7007
  }
7008
+ /**
7009
+ * Updates visibility of notes for a zone item (product or standalone note)
7010
+ *
7011
+ * @param appointmentId ID of the appointment
7012
+ * @param zoneId Zone ID
7013
+ * @param itemIndex Index of the item in the zone
7014
+ * @param notesVisibleToPatient Whether the notes should be visible to patient
7015
+ * @returns The updated appointment
7016
+ */
7017
+ async updateZoneItemNoteVisibility(appointmentId, zoneId, itemIndex, notesVisibleToPatient) {
7018
+ try {
7019
+ console.log(
7020
+ `[APPOINTMENT_SERVICE] Updating zone item note visibility at index ${itemIndex} for zone ${zoneId} to ${notesVisibleToPatient}`
7021
+ );
7022
+ return await updateZoneItemUtil(this.db, appointmentId, zoneId, itemIndex, {
7023
+ notesVisibleToPatient
7024
+ });
7025
+ } catch (error) {
7026
+ console.error(`[APPOINTMENT_SERVICE] Error updating zone item note visibility:`, error);
7027
+ throw error;
7028
+ }
7029
+ }
7007
7030
  /**
7008
7031
  * Gets a specific photo entry from a zone
7009
7032
  *
@@ -7032,7 +7055,13 @@ var AppointmentService = class extends BaseService {
7032
7055
  * @returns The updated appointment
7033
7056
  */
7034
7057
  async updateFinalizationNotes(appointmentId, sharedNotes, internalNotes) {
7058
+ var _a, _b, _c;
7035
7059
  try {
7060
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] updateFinalizationNotes called:", {
7061
+ appointmentId,
7062
+ sharedNotes,
7063
+ internalNotes
7064
+ });
7036
7065
  const appointment = await this.getAppointmentById(appointmentId);
7037
7066
  if (!appointment) {
7038
7067
  throw new Error(`Appointment ${appointmentId} not found`);
@@ -7049,23 +7078,40 @@ var AppointmentService = class extends BaseService {
7049
7078
  finalizationNotesInternal: null,
7050
7079
  finalizationNotes: null
7051
7080
  };
7081
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] Current metadata:", {
7082
+ finalizationNotesShared: currentMetadata.finalizationNotesShared,
7083
+ finalizationNotesInternal: currentMetadata.finalizationNotesInternal,
7084
+ finalizationNotes: currentMetadata.finalizationNotes
7085
+ });
7086
+ const metadataUpdate = {
7087
+ selectedZones: currentMetadata.selectedZones,
7088
+ zonePhotos: currentMetadata.zonePhotos,
7089
+ zonesData: currentMetadata.zonesData || null,
7090
+ appointmentProducts: currentMetadata.appointmentProducts || [],
7091
+ extendedProcedures: currentMetadata.extendedProcedures || [],
7092
+ recommendedProcedures: currentMetadata.recommendedProcedures || [],
7093
+ finalbilling: currentMetadata.finalbilling,
7094
+ finalizationNotesShared: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotesShared,
7095
+ finalizationNotesInternal: internalNotes !== void 0 ? internalNotes : currentMetadata.finalizationNotesInternal,
7096
+ // Keep deprecated field for backward compatibility during migration
7097
+ finalizationNotes: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared
7098
+ };
7099
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] Update data metadata:", {
7100
+ finalizationNotesShared: metadataUpdate.finalizationNotesShared,
7101
+ finalizationNotesInternal: metadataUpdate.finalizationNotesInternal,
7102
+ finalizationNotes: metadataUpdate.finalizationNotes
7103
+ });
7052
7104
  const updateData = {
7053
- metadata: {
7054
- selectedZones: currentMetadata.selectedZones,
7055
- zonePhotos: currentMetadata.zonePhotos,
7056
- zonesData: currentMetadata.zonesData || null,
7057
- appointmentProducts: currentMetadata.appointmentProducts || [],
7058
- extendedProcedures: currentMetadata.extendedProcedures || [],
7059
- recommendedProcedures: currentMetadata.recommendedProcedures || [],
7060
- finalbilling: currentMetadata.finalbilling,
7061
- finalizationNotesShared: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotesShared,
7062
- finalizationNotesInternal: internalNotes !== void 0 ? internalNotes : currentMetadata.finalizationNotesInternal,
7063
- // Keep deprecated field for backward compatibility during migration
7064
- finalizationNotes: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared
7065
- },
7105
+ metadata: metadataUpdate,
7066
7106
  updatedAt: (0, import_firestore14.serverTimestamp)()
7067
7107
  };
7068
- return await this.updateAppointment(appointmentId, updateData);
7108
+ const result = await this.updateAppointment(appointmentId, updateData);
7109
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] After update, result metadata:", {
7110
+ finalizationNotesShared: (_a = result.metadata) == null ? void 0 : _a.finalizationNotesShared,
7111
+ finalizationNotesInternal: (_b = result.metadata) == null ? void 0 : _b.finalizationNotesInternal,
7112
+ finalizationNotes: (_c = result.metadata) == null ? void 0 : _c.finalizationNotes
7113
+ });
7114
+ return result;
7069
7115
  } catch (error) {
7070
7116
  console.error(`[APPOINTMENT_SERVICE] Error updating finalization notes:`, error);
7071
7117
  throw error;