@blackcode_sa/metaestetics-api 1.14.8 → 1.14.10
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 +8 -19
- package/dist/index.mjs +8 -19
- package/package.json +1 -1
- package/src/services/auth/auth.service.ts +10 -27
package/dist/index.js
CHANGED
|
@@ -15984,7 +15984,7 @@ var AuthService = class extends BaseService {
|
|
|
15984
15984
|
* @returns Object containing user and claimed practitioner
|
|
15985
15985
|
*/
|
|
15986
15986
|
async claimDraftProfilesWithGoogle(idToken, practitionerIds) {
|
|
15987
|
-
var _a;
|
|
15987
|
+
var _a, _b;
|
|
15988
15988
|
try {
|
|
15989
15989
|
console.log("[AUTH] Starting claim draft profiles with Google", {
|
|
15990
15990
|
practitionerIdsCount: practitionerIds.length,
|
|
@@ -15993,24 +15993,13 @@ var AuthService = class extends BaseService {
|
|
|
15993
15993
|
if (practitionerIds.length === 0) {
|
|
15994
15994
|
throw new AuthError("No practitioner profiles selected to claim", "AUTH/NO_PROFILES_SELECTED", 400);
|
|
15995
15995
|
}
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
console.log("[AUTH] Using Firebase user:", firebaseUser.uid);
|
|
16004
|
-
await this.waitForAuthState(firebaseUser.uid);
|
|
16005
|
-
console.log("[AUTH] Forcing token refresh...");
|
|
16006
|
-
await firebaseUser.getIdToken(true);
|
|
16007
|
-
console.log("[AUTH] Token refreshed successfully");
|
|
16008
|
-
console.log("[AUTH] Verifying auth.currentUser:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
|
|
16009
|
-
console.log("[AUTH] Auth instance ID:", this.auth.__debugId || "no-id");
|
|
16010
|
-
if (!this.auth.__debugId) {
|
|
16011
|
-
this.auth.__debugId = "auth-" + Date.now();
|
|
16012
|
-
}
|
|
16013
|
-
console.log("[AUTH] Auth instance ID set to:", this.auth.__debugId);
|
|
15996
|
+
console.log("[AUTH] currentUser BEFORE sign-in:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
|
|
15997
|
+
console.log("[AUTH] Signing in with Google credential...");
|
|
15998
|
+
const credential = import_auth8.GoogleAuthProvider.credential(idToken);
|
|
15999
|
+
const result = await (0, import_auth8.signInWithCredential)(this.auth, credential);
|
|
16000
|
+
const firebaseUser = result.user;
|
|
16001
|
+
console.log("[AUTH] currentUser IMMEDIATELY AFTER sign-in:", ((_b = this.auth.currentUser) == null ? void 0 : _b.uid) || "NULL");
|
|
16002
|
+
console.log("[AUTH] User returned from signInWithCredential:", firebaseUser.uid);
|
|
16014
16003
|
const practitionerService = new PractitionerService(this.db, this.auth, this.app);
|
|
16015
16004
|
let user = null;
|
|
16016
16005
|
try {
|
package/dist/index.mjs
CHANGED
|
@@ -16071,7 +16071,7 @@ var AuthService = class extends BaseService {
|
|
|
16071
16071
|
* @returns Object containing user and claimed practitioner
|
|
16072
16072
|
*/
|
|
16073
16073
|
async claimDraftProfilesWithGoogle(idToken, practitionerIds) {
|
|
16074
|
-
var _a;
|
|
16074
|
+
var _a, _b;
|
|
16075
16075
|
try {
|
|
16076
16076
|
console.log("[AUTH] Starting claim draft profiles with Google", {
|
|
16077
16077
|
practitionerIdsCount: practitionerIds.length,
|
|
@@ -16080,24 +16080,13 @@ var AuthService = class extends BaseService {
|
|
|
16080
16080
|
if (practitionerIds.length === 0) {
|
|
16081
16081
|
throw new AuthError("No practitioner profiles selected to claim", "AUTH/NO_PROFILES_SELECTED", 400);
|
|
16082
16082
|
}
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
|
|
16090
|
-
console.log("[AUTH] Using Firebase user:", firebaseUser.uid);
|
|
16091
|
-
await this.waitForAuthState(firebaseUser.uid);
|
|
16092
|
-
console.log("[AUTH] Forcing token refresh...");
|
|
16093
|
-
await firebaseUser.getIdToken(true);
|
|
16094
|
-
console.log("[AUTH] Token refreshed successfully");
|
|
16095
|
-
console.log("[AUTH] Verifying auth.currentUser:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
|
|
16096
|
-
console.log("[AUTH] Auth instance ID:", this.auth.__debugId || "no-id");
|
|
16097
|
-
if (!this.auth.__debugId) {
|
|
16098
|
-
this.auth.__debugId = "auth-" + Date.now();
|
|
16099
|
-
}
|
|
16100
|
-
console.log("[AUTH] Auth instance ID set to:", this.auth.__debugId);
|
|
16083
|
+
console.log("[AUTH] currentUser BEFORE sign-in:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
|
|
16084
|
+
console.log("[AUTH] Signing in with Google credential...");
|
|
16085
|
+
const credential = GoogleAuthProvider.credential(idToken);
|
|
16086
|
+
const result = await signInWithCredential(this.auth, credential);
|
|
16087
|
+
const firebaseUser = result.user;
|
|
16088
|
+
console.log("[AUTH] currentUser IMMEDIATELY AFTER sign-in:", ((_b = this.auth.currentUser) == null ? void 0 : _b.uid) || "NULL");
|
|
16089
|
+
console.log("[AUTH] User returned from signInWithCredential:", firebaseUser.uid);
|
|
16101
16090
|
const practitionerService = new PractitionerService(this.db, this.auth, this.app);
|
|
16102
16091
|
let user = null;
|
|
16103
16092
|
try {
|
package/package.json
CHANGED
|
@@ -874,35 +874,18 @@ export class AuthService extends BaseService {
|
|
|
874
874
|
throw new AuthError('No practitioner profiles selected to claim', 'AUTH/NO_PROFILES_SELECTED', 400);
|
|
875
875
|
}
|
|
876
876
|
|
|
877
|
-
// Check
|
|
878
|
-
|
|
879
|
-
if (!firebaseUser) {
|
|
880
|
-
console.log('[AUTH] No current user, re-authenticating with Google credential');
|
|
881
|
-
const credential = GoogleAuthProvider.credential(idToken);
|
|
882
|
-
const result = await signInWithCredential(this.auth, credential);
|
|
883
|
-
firebaseUser = result.user;
|
|
884
|
-
}
|
|
885
|
-
console.log('[AUTH] Using Firebase user:', firebaseUser.uid);
|
|
877
|
+
// Check auth state BEFORE sign-in
|
|
878
|
+
console.log('[AUTH] currentUser BEFORE sign-in:', this.auth.currentUser?.uid || 'NULL');
|
|
886
879
|
|
|
887
|
-
//
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
await this.
|
|
891
|
-
|
|
892
|
-
// Force token refresh to ensure Firestore has fresh auth context
|
|
893
|
-
console.log('[AUTH] Forcing token refresh...');
|
|
894
|
-
await firebaseUser.getIdToken(true);
|
|
895
|
-
console.log('[AUTH] Token refreshed successfully');
|
|
880
|
+
// Sign in with Google credential
|
|
881
|
+
console.log('[AUTH] Signing in with Google credential...');
|
|
882
|
+
const credential = GoogleAuthProvider.credential(idToken);
|
|
883
|
+
const result = await signInWithCredential(this.auth, credential);
|
|
884
|
+
const firebaseUser = result.user;
|
|
896
885
|
|
|
897
|
-
//
|
|
898
|
-
console.log('[AUTH]
|
|
899
|
-
|
|
900
|
-
console.log('[AUTH] Auth instance ID:', (this.auth as any).__debugId || 'no-id');
|
|
901
|
-
// @ts-ignore - Add debug ID if not exists
|
|
902
|
-
if (!(this.auth as any).__debugId) {
|
|
903
|
-
(this.auth as any).__debugId = 'auth-' + Date.now();
|
|
904
|
-
}
|
|
905
|
-
console.log('[AUTH] Auth instance ID set to:', (this.auth as any).__debugId);
|
|
886
|
+
// Check auth state IMMEDIATELY AFTER sign-in
|
|
887
|
+
console.log('[AUTH] currentUser IMMEDIATELY AFTER sign-in:', this.auth.currentUser?.uid || 'NULL');
|
|
888
|
+
console.log('[AUTH] User returned from signInWithCredential:', firebaseUser.uid);
|
|
906
889
|
|
|
907
890
|
const practitionerService = new PractitionerService(this.db, this.auth, this.app);
|
|
908
891
|
|