@blackcode_sa/metaestetics-api 1.14.12 → 1.14.14
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 +15 -2
- package/dist/index.mjs +15 -2
- package/package.json +1 -1
- package/src/services/auth/auth.service.ts +25 -1
package/dist/index.js
CHANGED
|
@@ -15996,7 +15996,7 @@ var AuthService = class extends BaseService {
|
|
|
15996
15996
|
* @returns Object containing user and claimed practitioner
|
|
15997
15997
|
*/
|
|
15998
15998
|
async claimDraftProfilesWithGoogle(idToken, practitionerIds) {
|
|
15999
|
-
var _a, _b, _c;
|
|
15999
|
+
var _a, _b, _c, _d, _e;
|
|
16000
16000
|
try {
|
|
16001
16001
|
console.log("[AUTH] Starting claim draft profiles with Google", {
|
|
16002
16002
|
practitionerIdsCount: practitionerIds.length,
|
|
@@ -16013,6 +16013,7 @@ var AuthService = class extends BaseService {
|
|
|
16013
16013
|
console.log("[AUTH] currentUser IMMEDIATELY AFTER sign-in:", ((_b = this.auth.currentUser) == null ? void 0 : _b.uid) || "NULL");
|
|
16014
16014
|
console.log("[AUTH] User returned from signInWithCredential:", firebaseUser.uid);
|
|
16015
16015
|
const practitionerService = new PractitionerService(this.db, this.auth, this.app);
|
|
16016
|
+
console.log("[AUTH] currentUser after intializing practitionerService:", ((_c = this.auth.currentUser) == null ? void 0 : _c.uid) || "NULL");
|
|
16016
16017
|
let user = null;
|
|
16017
16018
|
try {
|
|
16018
16019
|
user = await this.userService.getUserById(firebaseUser.uid);
|
|
@@ -16022,8 +16023,20 @@ var AuthService = class extends BaseService {
|
|
|
16022
16023
|
}
|
|
16023
16024
|
if (!user) {
|
|
16024
16025
|
console.log("[AUTH] Creating user document DIRECTLY for:", firebaseUser.uid);
|
|
16025
|
-
console.log("[AUTH]
|
|
16026
|
+
console.log("[AUTH] Checking auth.currentUser BEFORE refresh:", ((_d = this.auth.currentUser) == null ? void 0 : _d.uid) || "NULL");
|
|
16027
|
+
try {
|
|
16028
|
+
const token = await firebaseUser.getIdToken(true);
|
|
16029
|
+
console.log("[AUTH] Got ID token, length:", (token == null ? void 0 : token.length) || 0);
|
|
16030
|
+
} catch (tokenError) {
|
|
16031
|
+
console.error("[AUTH] Error getting token:", tokenError);
|
|
16032
|
+
}
|
|
16033
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
16034
|
+
console.log("[AUTH] Using THIS.auth.currentUser AFTER refresh:", ((_e = this.auth.currentUser) == null ? void 0 : _e.uid) || "NULL");
|
|
16026
16035
|
console.log("[AUTH] Using THIS.db:", this.db ? "EXISTS" : "NULL");
|
|
16036
|
+
if (!this.auth.currentUser) {
|
|
16037
|
+
console.error("[AUTH] \u26A0\uFE0F auth.currentUser is STILL NULL after refresh! This is a React Native Firebase JS SDK issue.");
|
|
16038
|
+
console.error("[AUTH] Firestore will deny permission because request.auth will be null.");
|
|
16039
|
+
}
|
|
16027
16040
|
const userData = {
|
|
16028
16041
|
uid: firebaseUser.uid,
|
|
16029
16042
|
email: firebaseUser.email,
|
package/dist/index.mjs
CHANGED
|
@@ -16087,7 +16087,7 @@ var AuthService = class extends BaseService {
|
|
|
16087
16087
|
* @returns Object containing user and claimed practitioner
|
|
16088
16088
|
*/
|
|
16089
16089
|
async claimDraftProfilesWithGoogle(idToken, practitionerIds) {
|
|
16090
|
-
var _a, _b, _c;
|
|
16090
|
+
var _a, _b, _c, _d, _e;
|
|
16091
16091
|
try {
|
|
16092
16092
|
console.log("[AUTH] Starting claim draft profiles with Google", {
|
|
16093
16093
|
practitionerIdsCount: practitionerIds.length,
|
|
@@ -16104,6 +16104,7 @@ var AuthService = class extends BaseService {
|
|
|
16104
16104
|
console.log("[AUTH] currentUser IMMEDIATELY AFTER sign-in:", ((_b = this.auth.currentUser) == null ? void 0 : _b.uid) || "NULL");
|
|
16105
16105
|
console.log("[AUTH] User returned from signInWithCredential:", firebaseUser.uid);
|
|
16106
16106
|
const practitionerService = new PractitionerService(this.db, this.auth, this.app);
|
|
16107
|
+
console.log("[AUTH] currentUser after intializing practitionerService:", ((_c = this.auth.currentUser) == null ? void 0 : _c.uid) || "NULL");
|
|
16107
16108
|
let user = null;
|
|
16108
16109
|
try {
|
|
16109
16110
|
user = await this.userService.getUserById(firebaseUser.uid);
|
|
@@ -16113,8 +16114,20 @@ var AuthService = class extends BaseService {
|
|
|
16113
16114
|
}
|
|
16114
16115
|
if (!user) {
|
|
16115
16116
|
console.log("[AUTH] Creating user document DIRECTLY for:", firebaseUser.uid);
|
|
16116
|
-
console.log("[AUTH]
|
|
16117
|
+
console.log("[AUTH] Checking auth.currentUser BEFORE refresh:", ((_d = this.auth.currentUser) == null ? void 0 : _d.uid) || "NULL");
|
|
16118
|
+
try {
|
|
16119
|
+
const token = await firebaseUser.getIdToken(true);
|
|
16120
|
+
console.log("[AUTH] Got ID token, length:", (token == null ? void 0 : token.length) || 0);
|
|
16121
|
+
} catch (tokenError) {
|
|
16122
|
+
console.error("[AUTH] Error getting token:", tokenError);
|
|
16123
|
+
}
|
|
16124
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
16125
|
+
console.log("[AUTH] Using THIS.auth.currentUser AFTER refresh:", ((_e = this.auth.currentUser) == null ? void 0 : _e.uid) || "NULL");
|
|
16117
16126
|
console.log("[AUTH] Using THIS.db:", this.db ? "EXISTS" : "NULL");
|
|
16127
|
+
if (!this.auth.currentUser) {
|
|
16128
|
+
console.error("[AUTH] \u26A0\uFE0F auth.currentUser is STILL NULL after refresh! This is a React Native Firebase JS SDK issue.");
|
|
16129
|
+
console.error("[AUTH] Firestore will deny permission because request.auth will be null.");
|
|
16130
|
+
}
|
|
16118
16131
|
const userData = {
|
|
16119
16132
|
uid: firebaseUser.uid,
|
|
16120
16133
|
email: firebaseUser.email,
|
package/package.json
CHANGED
|
@@ -900,6 +900,7 @@ export class AuthService extends BaseService {
|
|
|
900
900
|
console.log('[AUTH] User returned from signInWithCredential:', firebaseUser.uid);
|
|
901
901
|
|
|
902
902
|
const practitionerService = new PractitionerService(this.db, this.auth, this.app);
|
|
903
|
+
console.log('[AUTH] currentUser after intializing practitionerService:', this.auth.currentUser?.uid || 'NULL');
|
|
903
904
|
|
|
904
905
|
// Step 1: Check if User document already exists
|
|
905
906
|
let user: User | null = null;
|
|
@@ -913,9 +914,32 @@ export class AuthService extends BaseService {
|
|
|
913
914
|
// Step 2: Create User document directly (bypassing UserService to test auth instance issue)
|
|
914
915
|
if (!user) {
|
|
915
916
|
console.log('[AUTH] Creating user document DIRECTLY for:', firebaseUser.uid);
|
|
916
|
-
|
|
917
|
+
|
|
918
|
+
// CRITICAL: Force auth state refresh right before setDoc
|
|
919
|
+
// React Native Firebase JS SDK has issues where auth.currentUser becomes NULL
|
|
920
|
+
// We need to ensure it's set before Firestore operations
|
|
921
|
+
console.log('[AUTH] Checking auth.currentUser BEFORE refresh:', this.auth.currentUser?.uid || 'NULL');
|
|
922
|
+
|
|
923
|
+
// Force token refresh to ensure auth state is set
|
|
924
|
+
try {
|
|
925
|
+
const token = await firebaseUser.getIdToken(true);
|
|
926
|
+
console.log('[AUTH] Got ID token, length:', token?.length || 0);
|
|
927
|
+
} catch (tokenError) {
|
|
928
|
+
console.error('[AUTH] Error getting token:', tokenError);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// Wait a tiny bit for auth state to propagate
|
|
932
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
933
|
+
|
|
934
|
+
console.log('[AUTH] Using THIS.auth.currentUser AFTER refresh:', this.auth.currentUser?.uid || 'NULL');
|
|
917
935
|
console.log('[AUTH] Using THIS.db:', this.db ? 'EXISTS' : 'NULL');
|
|
918
936
|
|
|
937
|
+
// If still NULL, this is a React Native Firebase JS SDK bug
|
|
938
|
+
if (!this.auth.currentUser) {
|
|
939
|
+
console.error('[AUTH] ⚠️ auth.currentUser is STILL NULL after refresh! This is a React Native Firebase JS SDK issue.');
|
|
940
|
+
console.error('[AUTH] Firestore will deny permission because request.auth will be null.');
|
|
941
|
+
}
|
|
942
|
+
|
|
919
943
|
const userData = {
|
|
920
944
|
uid: firebaseUser.uid,
|
|
921
945
|
email: firebaseUser.email,
|