@blackcode_sa/metaestetics-api 1.5.41 → 1.5.43

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.d.mts CHANGED
@@ -6576,6 +6576,11 @@ declare class AppointmentService extends BaseService {
6576
6576
  * @returns The updated appointment
6577
6577
  */
6578
6578
  updateInternalNotes(appointmentId: string, notes: string | null): Promise<Appointment>;
6579
+ /**
6580
+ * Debug helper: Get the current user's ID token for testing purposes
6581
+ * Use this token in Postman with Authorization: Bearer TOKEN
6582
+ */
6583
+ getDebugToken(): Promise<string | null>;
6579
6584
  }
6580
6585
 
6581
6586
  declare class AuthError extends Error {
package/dist/index.d.ts CHANGED
@@ -6576,6 +6576,11 @@ declare class AppointmentService extends BaseService {
6576
6576
  * @returns The updated appointment
6577
6577
  */
6578
6578
  updateInternalNotes(appointmentId: string, notes: string | null): Promise<Appointment>;
6579
+ /**
6580
+ * Debug helper: Get the current user's ID token for testing purposes
6581
+ * Use this token in Postman with Authorization: Bearer TOKEN
6582
+ */
6583
+ getDebugToken(): Promise<string | null>;
6579
6584
  }
6580
6585
 
6581
6586
  declare class AuthError extends Error {
package/dist/index.js CHANGED
@@ -11831,11 +11831,11 @@ var AppointmentService = class extends BaseService {
11831
11831
  "User must be authenticated to get available booking slots"
11832
11832
  );
11833
11833
  }
11834
+ const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/bookingApi/getAvailableBookingSlots`;
11834
11835
  const idToken = await currentUser.getIdToken();
11835
11836
  console.log(
11836
11837
  `[APPOINTMENT_SERVICE] Got user token, user ID: ${currentUser.uid}`
11837
11838
  );
11838
- const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/getAvailableBookingSlotsHttp`;
11839
11839
  const requestData = {
11840
11840
  clinicId,
11841
11841
  practitionerId,
@@ -12287,6 +12287,25 @@ var AppointmentService = class extends BaseService {
12287
12287
  };
12288
12288
  return this.updateAppointment(appointmentId, updateData);
12289
12289
  }
12290
+ /**
12291
+ * Debug helper: Get the current user's ID token for testing purposes
12292
+ * Use this token in Postman with Authorization: Bearer TOKEN
12293
+ */
12294
+ async getDebugToken() {
12295
+ try {
12296
+ const currentUser = this.auth.currentUser;
12297
+ if (!currentUser) {
12298
+ console.log("[APPOINTMENT_SERVICE] No user is signed in");
12299
+ return null;
12300
+ }
12301
+ const idToken = await currentUser.getIdToken();
12302
+ console.log("[APPOINTMENT_SERVICE] Debug token:", idToken);
12303
+ return idToken;
12304
+ } catch (error) {
12305
+ console.error("[APPOINTMENT_SERVICE] Error getting debug token:", error);
12306
+ return null;
12307
+ }
12308
+ }
12290
12309
  };
12291
12310
 
12292
12311
  // src/backoffice/services/brand.service.ts
package/dist/index.mjs CHANGED
@@ -11920,11 +11920,11 @@ var AppointmentService = class extends BaseService {
11920
11920
  "User must be authenticated to get available booking slots"
11921
11921
  );
11922
11922
  }
11923
+ const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/bookingApi/getAvailableBookingSlots`;
11923
11924
  const idToken = await currentUser.getIdToken();
11924
11925
  console.log(
11925
11926
  `[APPOINTMENT_SERVICE] Got user token, user ID: ${currentUser.uid}`
11926
11927
  );
11927
- const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/getAvailableBookingSlotsHttp`;
11928
11928
  const requestData = {
11929
11929
  clinicId,
11930
11930
  practitionerId,
@@ -12376,6 +12376,25 @@ var AppointmentService = class extends BaseService {
12376
12376
  };
12377
12377
  return this.updateAppointment(appointmentId, updateData);
12378
12378
  }
12379
+ /**
12380
+ * Debug helper: Get the current user's ID token for testing purposes
12381
+ * Use this token in Postman with Authorization: Bearer TOKEN
12382
+ */
12383
+ async getDebugToken() {
12384
+ try {
12385
+ const currentUser = this.auth.currentUser;
12386
+ if (!currentUser) {
12387
+ console.log("[APPOINTMENT_SERVICE] No user is signed in");
12388
+ return null;
12389
+ }
12390
+ const idToken = await currentUser.getIdToken();
12391
+ console.log("[APPOINTMENT_SERVICE] Debug token:", idToken);
12392
+ return idToken;
12393
+ } catch (error) {
12394
+ console.error("[APPOINTMENT_SERVICE] Error getting debug token:", error);
12395
+ return null;
12396
+ }
12397
+ }
12379
12398
  };
12380
12399
 
12381
12400
  // src/backoffice/services/brand.service.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.5.41",
4
+ "version": "1.5.43",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -171,7 +171,12 @@ export class AppointmentService extends BaseService {
171
171
  );
172
172
  }
173
173
 
174
+ // Construct the function URL for the Express app endpoint
175
+ const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/bookingApi/getAvailableBookingSlots`;
176
+
174
177
  // Get the authenticated user's ID token
178
+ // By default, getIdToken doesn't allow setting audience for web/mobile clients
179
+ // So we need to treat this token specially on the server side
175
180
  const idToken = await currentUser.getIdToken();
176
181
 
177
182
  // Log that we're getting a token
@@ -179,9 +184,6 @@ export class AppointmentService extends BaseService {
179
184
  `[APPOINTMENT_SERVICE] Got user token, user ID: ${currentUser.uid}`
180
185
  );
181
186
 
182
- // Construct the function URL - using the europe-west6 region
183
- const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/getAvailableBookingSlotsHttp`;
184
-
185
187
  // Alternate direct URL (if needed):
186
188
  // const functionUrl = `https://getavailablebookingslotshttp-grqala5m6a-oa.a.run.app`;
187
189
 
@@ -787,4 +789,25 @@ export class AppointmentService extends BaseService {
787
789
 
788
790
  return this.updateAppointment(appointmentId, updateData);
789
791
  }
792
+
793
+ /**
794
+ * Debug helper: Get the current user's ID token for testing purposes
795
+ * Use this token in Postman with Authorization: Bearer TOKEN
796
+ */
797
+ async getDebugToken(): Promise<string | null> {
798
+ try {
799
+ const currentUser = this.auth.currentUser;
800
+ if (!currentUser) {
801
+ console.log("[APPOINTMENT_SERVICE] No user is signed in");
802
+ return null;
803
+ }
804
+
805
+ const idToken = await currentUser.getIdToken();
806
+ console.log("[APPOINTMENT_SERVICE] Debug token:", idToken);
807
+ return idToken;
808
+ } catch (error) {
809
+ console.error("[APPOINTMENT_SERVICE] Error getting debug token:", error);
810
+ return null;
811
+ }
812
+ }
790
813
  }