@blackcode_sa/metaestetics-api 1.14.47 → 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
@@ -7005,6 +7005,28 @@ var AppointmentService = class extends BaseService {
7005
7005
  throw error;
7006
7006
  }
7007
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
+ }
7008
7030
  /**
7009
7031
  * Gets a specific photo entry from a zone
7010
7032
  *
@@ -7033,7 +7055,13 @@ var AppointmentService = class extends BaseService {
7033
7055
  * @returns The updated appointment
7034
7056
  */
7035
7057
  async updateFinalizationNotes(appointmentId, sharedNotes, internalNotes) {
7058
+ var _a, _b, _c;
7036
7059
  try {
7060
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] updateFinalizationNotes called:", {
7061
+ appointmentId,
7062
+ sharedNotes,
7063
+ internalNotes
7064
+ });
7037
7065
  const appointment = await this.getAppointmentById(appointmentId);
7038
7066
  if (!appointment) {
7039
7067
  throw new Error(`Appointment ${appointmentId} not found`);
@@ -7050,23 +7078,40 @@ var AppointmentService = class extends BaseService {
7050
7078
  finalizationNotesInternal: null,
7051
7079
  finalizationNotes: null
7052
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
+ });
7053
7104
  const updateData = {
7054
- metadata: {
7055
- selectedZones: currentMetadata.selectedZones,
7056
- zonePhotos: currentMetadata.zonePhotos,
7057
- zonesData: currentMetadata.zonesData || null,
7058
- appointmentProducts: currentMetadata.appointmentProducts || [],
7059
- extendedProcedures: currentMetadata.extendedProcedures || [],
7060
- recommendedProcedures: currentMetadata.recommendedProcedures || [],
7061
- finalbilling: currentMetadata.finalbilling,
7062
- finalizationNotesShared: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotesShared,
7063
- finalizationNotesInternal: internalNotes !== void 0 ? internalNotes : currentMetadata.finalizationNotesInternal,
7064
- // Keep deprecated field for backward compatibility during migration
7065
- finalizationNotes: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared
7066
- },
7105
+ metadata: metadataUpdate,
7067
7106
  updatedAt: (0, import_firestore14.serverTimestamp)()
7068
7107
  };
7069
- 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;
7070
7115
  } catch (error) {
7071
7116
  console.error(`[APPOINTMENT_SERVICE] Error updating finalization notes:`, error);
7072
7117
  throw error;
package/dist/index.mjs CHANGED
@@ -6891,6 +6891,28 @@ var AppointmentService = class extends BaseService {
6891
6891
  throw error;
6892
6892
  }
6893
6893
  }
6894
+ /**
6895
+ * Updates visibility of notes for a zone item (product or standalone note)
6896
+ *
6897
+ * @param appointmentId ID of the appointment
6898
+ * @param zoneId Zone ID
6899
+ * @param itemIndex Index of the item in the zone
6900
+ * @param notesVisibleToPatient Whether the notes should be visible to patient
6901
+ * @returns The updated appointment
6902
+ */
6903
+ async updateZoneItemNoteVisibility(appointmentId, zoneId, itemIndex, notesVisibleToPatient) {
6904
+ try {
6905
+ console.log(
6906
+ `[APPOINTMENT_SERVICE] Updating zone item note visibility at index ${itemIndex} for zone ${zoneId} to ${notesVisibleToPatient}`
6907
+ );
6908
+ return await updateZoneItemUtil(this.db, appointmentId, zoneId, itemIndex, {
6909
+ notesVisibleToPatient
6910
+ });
6911
+ } catch (error) {
6912
+ console.error(`[APPOINTMENT_SERVICE] Error updating zone item note visibility:`, error);
6913
+ throw error;
6914
+ }
6915
+ }
6894
6916
  /**
6895
6917
  * Gets a specific photo entry from a zone
6896
6918
  *
@@ -6919,7 +6941,13 @@ var AppointmentService = class extends BaseService {
6919
6941
  * @returns The updated appointment
6920
6942
  */
6921
6943
  async updateFinalizationNotes(appointmentId, sharedNotes, internalNotes) {
6944
+ var _a, _b, _c;
6922
6945
  try {
6946
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] updateFinalizationNotes called:", {
6947
+ appointmentId,
6948
+ sharedNotes,
6949
+ internalNotes
6950
+ });
6923
6951
  const appointment = await this.getAppointmentById(appointmentId);
6924
6952
  if (!appointment) {
6925
6953
  throw new Error(`Appointment ${appointmentId} not found`);
@@ -6936,23 +6964,40 @@ var AppointmentService = class extends BaseService {
6936
6964
  finalizationNotesInternal: null,
6937
6965
  finalizationNotes: null
6938
6966
  };
6967
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] Current metadata:", {
6968
+ finalizationNotesShared: currentMetadata.finalizationNotesShared,
6969
+ finalizationNotesInternal: currentMetadata.finalizationNotesInternal,
6970
+ finalizationNotes: currentMetadata.finalizationNotes
6971
+ });
6972
+ const metadataUpdate = {
6973
+ selectedZones: currentMetadata.selectedZones,
6974
+ zonePhotos: currentMetadata.zonePhotos,
6975
+ zonesData: currentMetadata.zonesData || null,
6976
+ appointmentProducts: currentMetadata.appointmentProducts || [],
6977
+ extendedProcedures: currentMetadata.extendedProcedures || [],
6978
+ recommendedProcedures: currentMetadata.recommendedProcedures || [],
6979
+ finalbilling: currentMetadata.finalbilling,
6980
+ finalizationNotesShared: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotesShared,
6981
+ finalizationNotesInternal: internalNotes !== void 0 ? internalNotes : currentMetadata.finalizationNotesInternal,
6982
+ // Keep deprecated field for backward compatibility during migration
6983
+ finalizationNotes: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared
6984
+ };
6985
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] Update data metadata:", {
6986
+ finalizationNotesShared: metadataUpdate.finalizationNotesShared,
6987
+ finalizationNotesInternal: metadataUpdate.finalizationNotesInternal,
6988
+ finalizationNotes: metadataUpdate.finalizationNotes
6989
+ });
6939
6990
  const updateData = {
6940
- metadata: {
6941
- selectedZones: currentMetadata.selectedZones,
6942
- zonePhotos: currentMetadata.zonePhotos,
6943
- zonesData: currentMetadata.zonesData || null,
6944
- appointmentProducts: currentMetadata.appointmentProducts || [],
6945
- extendedProcedures: currentMetadata.extendedProcedures || [],
6946
- recommendedProcedures: currentMetadata.recommendedProcedures || [],
6947
- finalbilling: currentMetadata.finalbilling,
6948
- finalizationNotesShared: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotesShared,
6949
- finalizationNotesInternal: internalNotes !== void 0 ? internalNotes : currentMetadata.finalizationNotesInternal,
6950
- // Keep deprecated field for backward compatibility during migration
6951
- finalizationNotes: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared
6952
- },
6991
+ metadata: metadataUpdate,
6953
6992
  updatedAt: serverTimestamp7()
6954
6993
  };
6955
- return await this.updateAppointment(appointmentId, updateData);
6994
+ const result = await this.updateAppointment(appointmentId, updateData);
6995
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] After update, result metadata:", {
6996
+ finalizationNotesShared: (_a = result.metadata) == null ? void 0 : _a.finalizationNotesShared,
6997
+ finalizationNotesInternal: (_b = result.metadata) == null ? void 0 : _b.finalizationNotesInternal,
6998
+ finalizationNotes: (_c = result.metadata) == null ? void 0 : _c.finalizationNotes
6999
+ });
7000
+ return result;
6956
7001
  } catch (error) {
6957
7002
  console.error(`[APPOINTMENT_SERVICE] Error updating finalization notes:`, error);
6958
7003
  throw error;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.14.47",
4
+ "version": "1.14.49",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -2200,6 +2200,34 @@ export class AppointmentService extends BaseService {
2200
2200
  }
2201
2201
  }
2202
2202
 
2203
+ /**
2204
+ * Updates visibility of notes for a zone item (product or standalone note)
2205
+ *
2206
+ * @param appointmentId ID of the appointment
2207
+ * @param zoneId Zone ID
2208
+ * @param itemIndex Index of the item in the zone
2209
+ * @param notesVisibleToPatient Whether the notes should be visible to patient
2210
+ * @returns The updated appointment
2211
+ */
2212
+ async updateZoneItemNoteVisibility(
2213
+ appointmentId: string,
2214
+ zoneId: string,
2215
+ itemIndex: number,
2216
+ notesVisibleToPatient: boolean,
2217
+ ): Promise<Appointment> {
2218
+ try {
2219
+ console.log(
2220
+ `[APPOINTMENT_SERVICE] Updating zone item note visibility at index ${itemIndex} for zone ${zoneId} to ${notesVisibleToPatient}`,
2221
+ );
2222
+ return await updateZoneItemUtil(this.db, appointmentId, zoneId, itemIndex, {
2223
+ notesVisibleToPatient,
2224
+ });
2225
+ } catch (error) {
2226
+ console.error(`[APPOINTMENT_SERVICE] Error updating zone item note visibility:`, error);
2227
+ throw error;
2228
+ }
2229
+ }
2230
+
2203
2231
  /**
2204
2232
  * Gets a specific photo entry from a zone
2205
2233
  *
@@ -2238,6 +2266,12 @@ export class AppointmentService extends BaseService {
2238
2266
  internalNotes?: string | null,
2239
2267
  ): Promise<Appointment> {
2240
2268
  try {
2269
+ console.log('🔍 [APPOINTMENT_SERVICE] updateFinalizationNotes called:', {
2270
+ appointmentId,
2271
+ sharedNotes,
2272
+ internalNotes,
2273
+ });
2274
+
2241
2275
  const appointment = await this.getAppointmentById(appointmentId);
2242
2276
  if (!appointment) {
2243
2277
  throw new Error(`Appointment ${appointmentId} not found`);
@@ -2256,29 +2290,51 @@ export class AppointmentService extends BaseService {
2256
2290
  finalizationNotes: null,
2257
2291
  };
2258
2292
 
2293
+ console.log('🔍 [APPOINTMENT_SERVICE] Current metadata:', {
2294
+ finalizationNotesShared: currentMetadata.finalizationNotesShared,
2295
+ finalizationNotesInternal: currentMetadata.finalizationNotesInternal,
2296
+ finalizationNotes: currentMetadata.finalizationNotes,
2297
+ });
2298
+
2299
+ const metadataUpdate = {
2300
+ selectedZones: currentMetadata.selectedZones,
2301
+ zonePhotos: currentMetadata.zonePhotos,
2302
+ zonesData: currentMetadata.zonesData || null,
2303
+ appointmentProducts: currentMetadata.appointmentProducts || [],
2304
+ extendedProcedures: currentMetadata.extendedProcedures || [],
2305
+ recommendedProcedures: currentMetadata.recommendedProcedures || [],
2306
+ finalbilling: currentMetadata.finalbilling,
2307
+ finalizationNotesShared:
2308
+ sharedNotes !== undefined ? sharedNotes : currentMetadata.finalizationNotesShared,
2309
+ finalizationNotesInternal:
2310
+ internalNotes !== undefined ? internalNotes : currentMetadata.finalizationNotesInternal,
2311
+ // Keep deprecated field for backward compatibility during migration
2312
+ finalizationNotes:
2313
+ sharedNotes !== undefined
2314
+ ? sharedNotes
2315
+ : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared,
2316
+ };
2317
+
2318
+ console.log('🔍 [APPOINTMENT_SERVICE] Update data metadata:', {
2319
+ finalizationNotesShared: metadataUpdate.finalizationNotesShared,
2320
+ finalizationNotesInternal: metadataUpdate.finalizationNotesInternal,
2321
+ finalizationNotes: metadataUpdate.finalizationNotes,
2322
+ });
2323
+
2259
2324
  const updateData: UpdateAppointmentData = {
2260
- metadata: {
2261
- selectedZones: currentMetadata.selectedZones,
2262
- zonePhotos: currentMetadata.zonePhotos,
2263
- zonesData: currentMetadata.zonesData || null,
2264
- appointmentProducts: currentMetadata.appointmentProducts || [],
2265
- extendedProcedures: currentMetadata.extendedProcedures || [],
2266
- recommendedProcedures: currentMetadata.recommendedProcedures || [],
2267
- finalbilling: currentMetadata.finalbilling,
2268
- finalizationNotesShared:
2269
- sharedNotes !== undefined ? sharedNotes : currentMetadata.finalizationNotesShared,
2270
- finalizationNotesInternal:
2271
- internalNotes !== undefined ? internalNotes : currentMetadata.finalizationNotesInternal,
2272
- // Keep deprecated field for backward compatibility during migration
2273
- finalizationNotes:
2274
- sharedNotes !== undefined
2275
- ? sharedNotes
2276
- : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared,
2277
- },
2325
+ metadata: metadataUpdate,
2278
2326
  updatedAt: serverTimestamp(),
2279
2327
  };
2280
2328
 
2281
- return await this.updateAppointment(appointmentId, updateData);
2329
+ const result = await this.updateAppointment(appointmentId, updateData);
2330
+
2331
+ console.log('🔍 [APPOINTMENT_SERVICE] After update, result metadata:', {
2332
+ finalizationNotesShared: result.metadata?.finalizationNotesShared,
2333
+ finalizationNotesInternal: result.metadata?.finalizationNotesInternal,
2334
+ finalizationNotes: result.metadata?.finalizationNotes,
2335
+ });
2336
+
2337
+ return result;
2282
2338
  } catch (error) {
2283
2339
  console.error(`[APPOINTMENT_SERVICE] Error updating finalization notes:`, error);
2284
2340
  throw error;
@@ -166,6 +166,7 @@ export interface ZoneItemData {
166
166
  parentZone: string; // Zone key in format "category.zone" (e.g., "face.forehead")
167
167
  subzones: string[];
168
168
  notes?: string;
169
+ notesVisibleToPatient?: boolean; // Whether notes are visible to patient (privacy-first, default false)
169
170
  subtotal?: number;
170
171
  ionNumber?: string;
171
172
  createdAt?: string; // ISO timestamp