@blackcode_sa/metaestetics-api 1.14.9 → 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 -11
- package/dist/index.mjs +8 -11
- package/package.json +1 -1
- package/src/services/auth/auth.service.ts +10 -20
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,16 +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] Auth state after waitForAuthState:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
|
|
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);
|
|
16006
16003
|
const practitionerService = new PractitionerService(this.db, this.auth, this.app);
|
|
16007
16004
|
let user = null;
|
|
16008
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,16 +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] Auth state after waitForAuthState:", ((_a = this.auth.currentUser) == null ? void 0 : _a.uid) || "NULL");
|
|
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);
|
|
16093
16090
|
const practitionerService = new PractitionerService(this.db, this.auth, this.app);
|
|
16094
16091
|
let user = null;
|
|
16095
16092
|
try {
|
package/package.json
CHANGED
|
@@ -874,28 +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);
|
|
886
|
-
|
|
887
|
-
// CRITICAL: Wait for auth state to settle in React Native
|
|
888
|
-
// The Firebase JS SDK doesn't update auth.currentUser synchronously after signInWithCredential
|
|
889
|
-
// This causes Firestore to not see the authenticated user, resulting in permission denied
|
|
890
|
-
await this.waitForAuthState(firebaseUser.uid);
|
|
877
|
+
// Check auth state BEFORE sign-in
|
|
878
|
+
console.log('[AUTH] currentUser BEFORE sign-in:', this.auth.currentUser?.uid || 'NULL');
|
|
891
879
|
|
|
892
|
-
//
|
|
893
|
-
console.log('[AUTH]
|
|
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;
|
|
894
885
|
|
|
895
|
-
//
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
// console.log('[AUTH] Token refreshed successfully');
|
|
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);
|
|
899
889
|
|
|
900
890
|
const practitionerService = new PractitionerService(this.db, this.auth, this.app);
|
|
901
891
|
|