@blackcode_sa/metaestetics-api 1.13.18 → 1.13.19

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.
@@ -1882,6 +1882,8 @@ declare enum SyncedCalendarProvider {
1882
1882
  declare enum CalendarEventStatus {
1883
1883
  PENDING = "pending",// When event is created, but not confirmed
1884
1884
  CONFIRMED = "confirmed",// When event is confirmed and ready to be used
1885
+ CHECKED_IN = "checked_in",// Patient has arrived and checked in
1886
+ IN_PROGRESS = "in_progress",// Procedure has started
1885
1887
  REJECTED = "rejected",// When event is rejected by the clinic administrator or patient
1886
1888
  CANCELED = "canceled",// When event is canceled by the patient
1887
1889
  RESCHEDULED = "rescheduled",// When event is rescheduled by the clinic administrator
@@ -1882,6 +1882,8 @@ declare enum SyncedCalendarProvider {
1882
1882
  declare enum CalendarEventStatus {
1883
1883
  PENDING = "pending",// When event is created, but not confirmed
1884
1884
  CONFIRMED = "confirmed",// When event is confirmed and ready to be used
1885
+ CHECKED_IN = "checked_in",// Patient has arrived and checked in
1886
+ IN_PROGRESS = "in_progress",// Procedure has started
1885
1887
  REJECTED = "rejected",// When event is rejected by the clinic administrator or patient
1886
1888
  CANCELED = "canceled",// When event is canceled by the patient
1887
1889
  RESCHEDULED = "rescheduled",// When event is rescheduled by the clinic administrator
package/dist/index.d.mts CHANGED
@@ -2756,6 +2756,8 @@ declare const SYNCED_CALENDARS_COLLECTION = "syncedCalendars";
2756
2756
  declare enum CalendarEventStatus {
2757
2757
  PENDING = "pending",// When event is created, but not confirmed
2758
2758
  CONFIRMED = "confirmed",// When event is confirmed and ready to be used
2759
+ CHECKED_IN = "checked_in",// Patient has arrived and checked in
2760
+ IN_PROGRESS = "in_progress",// Procedure has started
2759
2761
  REJECTED = "rejected",// When event is rejected by the clinic administrator or patient
2760
2762
  CANCELED = "canceled",// When event is canceled by the patient
2761
2763
  RESCHEDULED = "rescheduled",// When event is rescheduled by the clinic administrator
package/dist/index.d.ts CHANGED
@@ -2756,6 +2756,8 @@ declare const SYNCED_CALENDARS_COLLECTION = "syncedCalendars";
2756
2756
  declare enum CalendarEventStatus {
2757
2757
  PENDING = "pending",// When event is created, but not confirmed
2758
2758
  CONFIRMED = "confirmed",// When event is confirmed and ready to be used
2759
+ CHECKED_IN = "checked_in",// Patient has arrived and checked in
2760
+ IN_PROGRESS = "in_progress",// Procedure has started
2759
2761
  REJECTED = "rejected",// When event is rejected by the clinic administrator or patient
2760
2762
  CANCELED = "canceled",// When event is canceled by the patient
2761
2763
  RESCHEDULED = "rescheduled",// When event is rescheduled by the clinic administrator
package/dist/index.js CHANGED
@@ -4473,6 +4473,8 @@ var import_firestore6 = require("firebase/firestore");
4473
4473
  var CalendarEventStatus = /* @__PURE__ */ ((CalendarEventStatus4) => {
4474
4474
  CalendarEventStatus4["PENDING"] = "pending";
4475
4475
  CalendarEventStatus4["CONFIRMED"] = "confirmed";
4476
+ CalendarEventStatus4["CHECKED_IN"] = "checked_in";
4477
+ CalendarEventStatus4["IN_PROGRESS"] = "in_progress";
4476
4478
  CalendarEventStatus4["REJECTED"] = "rejected";
4477
4479
  CalendarEventStatus4["CANCELED"] = "canceled";
4478
4480
  CalendarEventStatus4["RESCHEDULED"] = "rescheduled";
@@ -4628,11 +4630,21 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
4628
4630
  }
4629
4631
  let calendarStatus;
4630
4632
  switch (appointmentStatus) {
4633
+ case "pending" /* PENDING */:
4634
+ calendarStatus = "pending";
4635
+ break;
4631
4636
  case "confirmed" /* CONFIRMED */:
4632
4637
  calendarStatus = "confirmed";
4633
4638
  break;
4639
+ case "checked_in" /* CHECKED_IN */:
4640
+ calendarStatus = "checked_in";
4641
+ break;
4642
+ case "in_progress" /* IN_PROGRESS */:
4643
+ calendarStatus = "in_progress";
4644
+ break;
4634
4645
  case "canceled_patient" /* CANCELED_PATIENT */:
4635
4646
  case "canceled_clinic" /* CANCELED_CLINIC */:
4647
+ case "canceled_patient_rescheduled" /* CANCELED_PATIENT_RESCHEDULED */:
4636
4648
  calendarStatus = "canceled";
4637
4649
  break;
4638
4650
  case "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */:
@@ -4641,7 +4653,11 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
4641
4653
  case "completed" /* COMPLETED */:
4642
4654
  calendarStatus = "completed";
4643
4655
  break;
4656
+ case "no_show" /* NO_SHOW */:
4657
+ calendarStatus = "no_show";
4658
+ break;
4644
4659
  default:
4660
+ console.warn(`Unknown appointment status: ${appointmentStatus}, not updating calendar event`);
4645
4661
  return;
4646
4662
  }
4647
4663
  await (0, import_firestore6.updateDoc)(calendarEventRef, {
@@ -17830,10 +17846,20 @@ var CalendarServiceV2 = class extends BaseService {
17830
17846
  ],
17831
17847
  ["confirmed" /* CONFIRMED */]: [
17832
17848
  "canceled" /* CANCELED */,
17849
+ "checked_in" /* CHECKED_IN */,
17833
17850
  "completed" /* COMPLETED */,
17834
17851
  "rescheduled" /* RESCHEDULED */,
17835
17852
  "no_show" /* NO_SHOW */
17836
17853
  ],
17854
+ ["checked_in" /* CHECKED_IN */]: [
17855
+ "in_progress" /* IN_PROGRESS */,
17856
+ "completed" /* COMPLETED */,
17857
+ "canceled" /* CANCELED */
17858
+ ],
17859
+ ["in_progress" /* IN_PROGRESS */]: [
17860
+ "completed" /* COMPLETED */,
17861
+ "canceled" /* CANCELED */
17862
+ ],
17837
17863
  ["rejected" /* REJECTED */]: [],
17838
17864
  ["canceled" /* CANCELED */]: [],
17839
17865
  ["rescheduled" /* RESCHEDULED */]: [
@@ -22002,12 +22028,18 @@ var ReviewService = class extends BaseService {
22002
22028
  updatedAt: now
22003
22029
  };
22004
22030
  reviewSchema.parse(review);
22005
- const docRef = (0, import_firestore59.doc)(this.db, REVIEWS_COLLECTION, reviewId);
22006
- await (0, import_firestore59.setDoc)(docRef, {
22031
+ const firestoreData = {
22007
22032
  ...review,
22008
22033
  createdAt: (0, import_firestore59.serverTimestamp)(),
22009
22034
  updatedAt: (0, import_firestore59.serverTimestamp)()
22035
+ };
22036
+ Object.keys(firestoreData).forEach((key) => {
22037
+ if (firestoreData[key] === void 0) {
22038
+ delete firestoreData[key];
22039
+ }
22010
22040
  });
22041
+ const docRef = (0, import_firestore59.doc)(this.db, REVIEWS_COLLECTION, reviewId);
22042
+ await (0, import_firestore59.setDoc)(docRef, firestoreData);
22011
22043
  console.log("\u2705 ReviewService.createReview - Review saved to Firestore:", {
22012
22044
  reviewId,
22013
22045
  practitionerId: (_e = review.practitionerReview) == null ? void 0 : _e.practitionerId,
package/dist/index.mjs CHANGED
@@ -4360,6 +4360,8 @@ import {
4360
4360
  var CalendarEventStatus = /* @__PURE__ */ ((CalendarEventStatus4) => {
4361
4361
  CalendarEventStatus4["PENDING"] = "pending";
4362
4362
  CalendarEventStatus4["CONFIRMED"] = "confirmed";
4363
+ CalendarEventStatus4["CHECKED_IN"] = "checked_in";
4364
+ CalendarEventStatus4["IN_PROGRESS"] = "in_progress";
4363
4365
  CalendarEventStatus4["REJECTED"] = "rejected";
4364
4366
  CalendarEventStatus4["CANCELED"] = "canceled";
4365
4367
  CalendarEventStatus4["RESCHEDULED"] = "rescheduled";
@@ -4515,11 +4517,21 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
4515
4517
  }
4516
4518
  let calendarStatus;
4517
4519
  switch (appointmentStatus) {
4520
+ case "pending" /* PENDING */:
4521
+ calendarStatus = "pending";
4522
+ break;
4518
4523
  case "confirmed" /* CONFIRMED */:
4519
4524
  calendarStatus = "confirmed";
4520
4525
  break;
4526
+ case "checked_in" /* CHECKED_IN */:
4527
+ calendarStatus = "checked_in";
4528
+ break;
4529
+ case "in_progress" /* IN_PROGRESS */:
4530
+ calendarStatus = "in_progress";
4531
+ break;
4521
4532
  case "canceled_patient" /* CANCELED_PATIENT */:
4522
4533
  case "canceled_clinic" /* CANCELED_CLINIC */:
4534
+ case "canceled_patient_rescheduled" /* CANCELED_PATIENT_RESCHEDULED */:
4523
4535
  calendarStatus = "canceled";
4524
4536
  break;
4525
4537
  case "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */:
@@ -4528,7 +4540,11 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
4528
4540
  case "completed" /* COMPLETED */:
4529
4541
  calendarStatus = "completed";
4530
4542
  break;
4543
+ case "no_show" /* NO_SHOW */:
4544
+ calendarStatus = "no_show";
4545
+ break;
4531
4546
  default:
4547
+ console.warn(`Unknown appointment status: ${appointmentStatus}, not updating calendar event`);
4532
4548
  return;
4533
4549
  }
4534
4550
  await updateDoc2(calendarEventRef, {
@@ -17987,10 +18003,20 @@ var CalendarServiceV2 = class extends BaseService {
17987
18003
  ],
17988
18004
  ["confirmed" /* CONFIRMED */]: [
17989
18005
  "canceled" /* CANCELED */,
18006
+ "checked_in" /* CHECKED_IN */,
17990
18007
  "completed" /* COMPLETED */,
17991
18008
  "rescheduled" /* RESCHEDULED */,
17992
18009
  "no_show" /* NO_SHOW */
17993
18010
  ],
18011
+ ["checked_in" /* CHECKED_IN */]: [
18012
+ "in_progress" /* IN_PROGRESS */,
18013
+ "completed" /* COMPLETED */,
18014
+ "canceled" /* CANCELED */
18015
+ ],
18016
+ ["in_progress" /* IN_PROGRESS */]: [
18017
+ "completed" /* COMPLETED */,
18018
+ "canceled" /* CANCELED */
18019
+ ],
17994
18020
  ["rejected" /* REJECTED */]: [],
17995
18021
  ["canceled" /* CANCELED */]: [],
17996
18022
  ["rescheduled" /* RESCHEDULED */]: [
@@ -22248,12 +22274,18 @@ var ReviewService = class extends BaseService {
22248
22274
  updatedAt: now
22249
22275
  };
22250
22276
  reviewSchema.parse(review);
22251
- const docRef = doc40(this.db, REVIEWS_COLLECTION, reviewId);
22252
- await setDoc28(docRef, {
22277
+ const firestoreData = {
22253
22278
  ...review,
22254
22279
  createdAt: serverTimestamp32(),
22255
22280
  updatedAt: serverTimestamp32()
22281
+ };
22282
+ Object.keys(firestoreData).forEach((key) => {
22283
+ if (firestoreData[key] === void 0) {
22284
+ delete firestoreData[key];
22285
+ }
22256
22286
  });
22287
+ const docRef = doc40(this.db, REVIEWS_COLLECTION, reviewId);
22288
+ await setDoc28(docRef, firestoreData);
22257
22289
  console.log("\u2705 ReviewService.createReview - Review saved to Firestore:", {
22258
22290
  reviewId,
22259
22291
  practitionerId: (_e = review.practitionerReview) == null ? void 0 : _e.practitionerId,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.13.18",
4
+ "version": "1.13.19",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -423,11 +423,21 @@ async function updateCalendarEventStatus(
423
423
  // Map appointment status to calendar event status
424
424
  let calendarStatus;
425
425
  switch (appointmentStatus) {
426
+ case AppointmentStatus.PENDING:
427
+ calendarStatus = 'pending';
428
+ break;
426
429
  case AppointmentStatus.CONFIRMED:
427
430
  calendarStatus = 'confirmed';
428
431
  break;
432
+ case AppointmentStatus.CHECKED_IN:
433
+ calendarStatus = 'checked_in';
434
+ break;
435
+ case AppointmentStatus.IN_PROGRESS:
436
+ calendarStatus = 'in_progress';
437
+ break;
429
438
  case AppointmentStatus.CANCELED_PATIENT:
430
439
  case AppointmentStatus.CANCELED_CLINIC:
440
+ case AppointmentStatus.CANCELED_PATIENT_RESCHEDULED:
431
441
  calendarStatus = 'canceled';
432
442
  break;
433
443
  case AppointmentStatus.RESCHEDULED_BY_CLINIC:
@@ -436,8 +446,12 @@ async function updateCalendarEventStatus(
436
446
  case AppointmentStatus.COMPLETED:
437
447
  calendarStatus = 'completed';
438
448
  break;
449
+ case AppointmentStatus.NO_SHOW:
450
+ calendarStatus = 'no_show';
451
+ break;
439
452
  default:
440
- // For other states, don't update the calendar status
453
+ // For unknown states, don't update the calendar status
454
+ console.warn(`Unknown appointment status: ${appointmentStatus}, not updating calendar event`);
441
455
  return;
442
456
  }
443
457
 
@@ -1140,10 +1140,20 @@ export class CalendarServiceV2 extends BaseService {
1140
1140
  ],
1141
1141
  [CalendarEventStatus.CONFIRMED]: [
1142
1142
  CalendarEventStatus.CANCELED,
1143
+ CalendarEventStatus.CHECKED_IN,
1143
1144
  CalendarEventStatus.COMPLETED,
1144
1145
  CalendarEventStatus.RESCHEDULED,
1145
1146
  CalendarEventStatus.NO_SHOW,
1146
1147
  ],
1148
+ [CalendarEventStatus.CHECKED_IN]: [
1149
+ CalendarEventStatus.IN_PROGRESS,
1150
+ CalendarEventStatus.COMPLETED,
1151
+ CalendarEventStatus.CANCELED,
1152
+ ],
1153
+ [CalendarEventStatus.IN_PROGRESS]: [
1154
+ CalendarEventStatus.COMPLETED,
1155
+ CalendarEventStatus.CANCELED,
1156
+ ],
1147
1157
  [CalendarEventStatus.REJECTED]: [],
1148
1158
  [CalendarEventStatus.CANCELED]: [],
1149
1159
  [CalendarEventStatus.RESCHEDULED]: [
@@ -213,14 +213,25 @@ export class ReviewService extends BaseService {
213
213
  // Validate complete review object
214
214
  reviewSchema.parse(review);
215
215
 
216
- // Save the review to Firestore
217
- const docRef = doc(this.db, REVIEWS_COLLECTION, reviewId);
218
- await setDoc(docRef, {
216
+ // Prepare Firestore document, filtering out undefined values
217
+ // Firebase doesn't accept undefined values, so we omit them
218
+ const firestoreData: any = {
219
219
  ...review,
220
220
  createdAt: serverTimestamp(),
221
221
  updatedAt: serverTimestamp(),
222
+ };
223
+
224
+ // Remove undefined fields to prevent Firebase errors
225
+ Object.keys(firestoreData).forEach((key) => {
226
+ if (firestoreData[key] === undefined) {
227
+ delete firestoreData[key];
228
+ }
222
229
  });
223
230
 
231
+ // Save the review to Firestore
232
+ const docRef = doc(this.db, REVIEWS_COLLECTION, reviewId);
233
+ await setDoc(docRef, firestoreData);
234
+
224
235
  console.log('✅ ReviewService.createReview - Review saved to Firestore:', {
225
236
  reviewId,
226
237
  practitionerId: review.practitionerReview?.practitionerId,
@@ -23,6 +23,8 @@ import type {
23
23
  export enum CalendarEventStatus {
24
24
  PENDING = "pending", // When event is created, but not confirmed
25
25
  CONFIRMED = "confirmed", // When event is confirmed and ready to be used
26
+ CHECKED_IN = "checked_in", // Patient has arrived and checked in
27
+ IN_PROGRESS = "in_progress", // Procedure has started
26
28
  REJECTED = "rejected", // When event is rejected by the clinic administrator or patient
27
29
  CANCELED = "canceled", // When event is canceled by the patient
28
30
  RESCHEDULED = "rescheduled", // When event is rescheduled by the clinic administrator