@proveanything/smartlinks-auth-ui 0.1.14 → 0.1.15
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 +11 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -11267,18 +11267,15 @@ 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
|
-
try {
|
|
11276
|
-
// Fetch account details from parent via proxied API call
|
|
11277
|
-
const accountResponse = await smartlinks__namespace.auth.getAccount();
|
|
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
|
+
if (accountResponse) {
|
|
11278
11275
|
// Build user object from account response
|
|
11279
11276
|
const accountAny = accountResponse;
|
|
11280
11277
|
const userFromAccount = {
|
|
11281
|
-
uid: userId,
|
|
11278
|
+
uid: accountAny?.uid || accountAny?.id || accountAny?.userId,
|
|
11282
11279
|
email: accountAny?.email,
|
|
11283
11280
|
displayName: accountAny?.displayName || accountAny?.name,
|
|
11284
11281
|
phoneNumber: accountAny?.phoneNumber,
|
|
@@ -11289,13 +11286,13 @@ const AuthProvider = ({ children, proxyMode = false, accountCacheTTL = 5 * 60 *
|
|
|
11289
11286
|
console.log('[AuthContext] Proxy mode: initialized from parent account');
|
|
11290
11287
|
notifyAuthStateChange('LOGIN', userFromAccount, null, accountResponse, accountResponse);
|
|
11291
11288
|
}
|
|
11292
|
-
|
|
11293
|
-
console.
|
|
11294
|
-
// No session - that's ok, user may need to login
|
|
11289
|
+
else {
|
|
11290
|
+
console.log('[AuthContext] Proxy mode: no existing session, awaiting login');
|
|
11295
11291
|
}
|
|
11296
11292
|
}
|
|
11297
|
-
|
|
11298
|
-
console.log('[AuthContext] Proxy mode: no
|
|
11293
|
+
catch (error) {
|
|
11294
|
+
console.log('[AuthContext] Proxy mode: no existing session (auth.getAccount returned error), awaiting login');
|
|
11295
|
+
// No session - that's ok, user may need to login
|
|
11299
11296
|
}
|
|
11300
11297
|
setIsLoading(false);
|
|
11301
11298
|
return;
|