@proveanything/smartlinks-auth-ui 0.1.14 → 0.1.16
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/context/AuthContext.d.ts.map +1 -1
- package/dist/index.esm.js +16 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -11267,18 +11267,18 @@ const AuthProvider = ({ children, proxyMode = false, accountCacheTTL = 5 * 60 *
|
|
|
11267
11267
|
const initializeAuth = async () => {
|
|
11268
11268
|
try {
|
|
11269
11269
|
if (proxyMode) {
|
|
11270
|
-
// PROXY MODE:
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
|
|
11279
|
-
|
|
11270
|
+
// PROXY MODE: Check for existing session via parent's auth.getAccount()
|
|
11271
|
+
console.log('[AuthContext] Proxy mode: checking for existing session via auth.getAccount()');
|
|
11272
|
+
try {
|
|
11273
|
+
const accountResponse = await smartlinks__namespace.auth.getAccount();
|
|
11274
|
+
// auth.getAccount() always returns a response object, but uid will be
|
|
11275
|
+
// empty/undefined if no user is logged in
|
|
11276
|
+
const accountAny = accountResponse;
|
|
11277
|
+
const hasValidSession = accountAny?.uid && accountAny.uid.length > 0;
|
|
11278
|
+
if (hasValidSession) {
|
|
11279
|
+
// User is logged in with valid account
|
|
11280
11280
|
const userFromAccount = {
|
|
11281
|
-
uid:
|
|
11281
|
+
uid: accountAny.uid,
|
|
11282
11282
|
email: accountAny?.email,
|
|
11283
11283
|
displayName: accountAny?.displayName || accountAny?.name,
|
|
11284
11284
|
phoneNumber: accountAny?.phoneNumber,
|
|
@@ -11286,16 +11286,15 @@ const AuthProvider = ({ children, proxyMode = false, accountCacheTTL = 5 * 60 *
|
|
|
11286
11286
|
setUser(userFromAccount);
|
|
11287
11287
|
setAccountData(accountResponse);
|
|
11288
11288
|
setAccountInfo(accountResponse);
|
|
11289
|
-
console.log('[AuthContext] Proxy mode: initialized from parent account');
|
|
11289
|
+
console.log('[AuthContext] Proxy mode: initialized from parent account, uid:', accountAny.uid);
|
|
11290
11290
|
notifyAuthStateChange('LOGIN', userFromAccount, null, accountResponse, accountResponse);
|
|
11291
11291
|
}
|
|
11292
|
-
|
|
11293
|
-
console.
|
|
11294
|
-
// No session - that's ok, user may need to login
|
|
11292
|
+
else {
|
|
11293
|
+
console.log('[AuthContext] Proxy mode: no valid session (no uid), awaiting login');
|
|
11295
11294
|
}
|
|
11296
11295
|
}
|
|
11297
|
-
|
|
11298
|
-
console.log('[AuthContext] Proxy mode:
|
|
11296
|
+
catch (error) {
|
|
11297
|
+
console.log('[AuthContext] Proxy mode: auth.getAccount() failed, awaiting login:', error);
|
|
11299
11298
|
}
|
|
11300
11299
|
setIsLoading(false);
|
|
11301
11300
|
return;
|