@blackcode_sa/metaestetics-api 1.14.52 → 1.14.53

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.
package/dist/index.js CHANGED
@@ -4843,7 +4843,6 @@ function initializeMetadata(appointment) {
4843
4843
  };
4844
4844
  }
4845
4845
  async function addItemToZoneUtil(db, appointmentId, zoneId, item) {
4846
- var _a;
4847
4846
  validateZoneKeyFormat(zoneId);
4848
4847
  const appointment = await getAppointmentOrThrow(db, appointmentId);
4849
4848
  const metadata = initializeMetadata(appointment);
@@ -4852,15 +4851,19 @@ async function addItemToZoneUtil(db, appointmentId, zoneId, item) {
4852
4851
  zonesData[zoneId] = [];
4853
4852
  }
4854
4853
  const now = (/* @__PURE__ */ new Date()).toISOString();
4854
+ const cleanItem = Object.fromEntries(
4855
+ Object.entries(item).filter(([_, value]) => value !== void 0)
4856
+ );
4857
+ const notesVisibleToPatientValue = cleanItem.notesVisibleToPatient !== void 0 ? cleanItem.notesVisibleToPatient : cleanItem.notes ? false : void 0;
4855
4858
  const itemWithSubtotal = {
4856
- ...item,
4859
+ ...cleanItem,
4857
4860
  parentZone: zoneId,
4858
4861
  // Set parentZone to the zone key
4859
- subtotal: calculateItemSubtotal(item),
4860
- // Set default visibility to false (privacy-first) if notes exist and visibility not explicitly set
4861
- notesVisibleToPatient: (_a = item.notesVisibleToPatient) != null ? _a : item.notes ? false : void 0,
4862
+ subtotal: calculateItemSubtotal(cleanItem),
4862
4863
  createdAt: now,
4863
- updatedAt: now
4864
+ updatedAt: now,
4865
+ // Only include notesVisibleToPatient if it has a defined boolean value
4866
+ ...typeof notesVisibleToPatientValue === "boolean" && { notesVisibleToPatient: notesVisibleToPatientValue }
4864
4867
  };
4865
4868
  zonesData[zoneId].push(itemWithSubtotal);
4866
4869
  const finalbilling = calculateFinalBilling(zonesData, 0.081);
package/dist/index.mjs CHANGED
@@ -4729,7 +4729,6 @@ function initializeMetadata(appointment) {
4729
4729
  };
4730
4730
  }
4731
4731
  async function addItemToZoneUtil(db, appointmentId, zoneId, item) {
4732
- var _a;
4733
4732
  validateZoneKeyFormat(zoneId);
4734
4733
  const appointment = await getAppointmentOrThrow(db, appointmentId);
4735
4734
  const metadata = initializeMetadata(appointment);
@@ -4738,15 +4737,19 @@ async function addItemToZoneUtil(db, appointmentId, zoneId, item) {
4738
4737
  zonesData[zoneId] = [];
4739
4738
  }
4740
4739
  const now = (/* @__PURE__ */ new Date()).toISOString();
4740
+ const cleanItem = Object.fromEntries(
4741
+ Object.entries(item).filter(([_, value]) => value !== void 0)
4742
+ );
4743
+ const notesVisibleToPatientValue = cleanItem.notesVisibleToPatient !== void 0 ? cleanItem.notesVisibleToPatient : cleanItem.notes ? false : void 0;
4741
4744
  const itemWithSubtotal = {
4742
- ...item,
4745
+ ...cleanItem,
4743
4746
  parentZone: zoneId,
4744
4747
  // Set parentZone to the zone key
4745
- subtotal: calculateItemSubtotal(item),
4746
- // Set default visibility to false (privacy-first) if notes exist and visibility not explicitly set
4747
- notesVisibleToPatient: (_a = item.notesVisibleToPatient) != null ? _a : item.notes ? false : void 0,
4748
+ subtotal: calculateItemSubtotal(cleanItem),
4748
4749
  createdAt: now,
4749
- updatedAt: now
4750
+ updatedAt: now,
4751
+ // Only include notesVisibleToPatient if it has a defined boolean value
4752
+ ...typeof notesVisibleToPatientValue === "boolean" && { notesVisibleToPatient: notesVisibleToPatientValue }
4750
4753
  };
4751
4754
  zonesData[zoneId].push(itemWithSubtotal);
4752
4755
  const finalbilling = calculateFinalBilling(zonesData, 0.081);
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.52",
4
+ "version": "1.14.53",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -159,14 +159,25 @@ export async function addItemToZoneUtil(
159
159
 
160
160
  // Calculate subtotal for the item
161
161
  const now = new Date().toISOString();
162
+
163
+ // Filter out undefined values from item (Firestore doesn't allow undefined)
164
+ const cleanItem = Object.fromEntries(
165
+ Object.entries(item).filter(([_, value]) => value !== undefined)
166
+ ) as Omit<ZoneItemData, 'subtotal' | 'parentZone'>;
167
+
168
+ // Determine notesVisibleToPatient value (privacy-first: default to false if notes exist, otherwise omit)
169
+ const notesVisibleToPatientValue = cleanItem.notesVisibleToPatient !== undefined
170
+ ? cleanItem.notesVisibleToPatient
171
+ : (cleanItem.notes ? false : undefined);
172
+
162
173
  const itemWithSubtotal: ZoneItemData = {
163
- ...item,
174
+ ...cleanItem,
164
175
  parentZone: zoneId, // Set parentZone to the zone key
165
- subtotal: calculateItemSubtotal(item),
166
- // Set default visibility to false (privacy-first) if notes exist and visibility not explicitly set
167
- notesVisibleToPatient: item.notesVisibleToPatient ?? (item.notes ? false : undefined),
176
+ subtotal: calculateItemSubtotal(cleanItem),
168
177
  createdAt: now,
169
178
  updatedAt: now,
179
+ // Only include notesVisibleToPatient if it has a defined boolean value
180
+ ...(typeof notesVisibleToPatientValue === 'boolean' && { notesVisibleToPatient: notesVisibleToPatientValue }),
170
181
  };
171
182
 
172
183
  // Add item to zone