@proveanything/smartlinks-auth-ui 0.5.19 → 0.5.20

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 CHANGED
@@ -12826,15 +12826,31 @@ collectionId, enableContactSync, enableInteractionTracking, interactionAppId, in
12826
12826
  // NOW set isVerified - after parent has acknowledged and session is ready
12827
12827
  setIsVerified(true);
12828
12828
  notifyAuthStateChange('LOGIN', authUser, authToken, authAccountData || null, authAccountData || null, true);
12829
- // Sync contact (non-blocking)
12830
- const newContactId = await syncContact(authUser, authAccountData);
12831
- // Track interaction (non-blocking)
12832
- trackInteraction(isNewUser ? 'signup' : 'login', authUser.uid, newContactId, {
12833
- provider: authUser.email ? 'email' : 'phone',
12829
+ // Sync contact + track interaction (truly non-blocking - never block login success)
12830
+ syncContact(authUser, authAccountData)
12831
+ .then((newContactId) => {
12832
+ trackInteraction(isNewUser ? 'signup' : 'login', authUser.uid, newContactId, {
12833
+ provider: authUser.email ? 'email' : 'phone',
12834
+ });
12835
+ })
12836
+ .catch((err) => {
12837
+ console.warn('[AuthContext] Post-login contact sync failed (non-fatal):', err);
12834
12838
  });
12835
12839
  // Optionally preload account info on login (standalone mode only)
12840
+ // NOTE: We call the SDK directly here instead of getAccount(true) because
12841
+ // the memoized getAccount closure still sees token=null (state just set,
12842
+ // not yet committed), which would throw "Not authenticated" spuriously.
12836
12843
  if (!proxyMode && preloadAccountInfo) {
12837
- getAccount(true).catch(() => { });
12844
+ (async () => {
12845
+ try {
12846
+ const fresh = await smartlinks__namespace.auth.getAccount();
12847
+ await tokenStorage.saveAccountInfo(fresh, accountCacheTTL);
12848
+ setAccountInfo(fresh);
12849
+ }
12850
+ catch {
12851
+ /* non-fatal preload */
12852
+ }
12853
+ })();
12838
12854
  }
12839
12855
  }
12840
12856
  catch (error) {