@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.
@@ -1 +1 @@
1
- {"version":3,"file":"AuthContext.d.ts","sourceRoot":"","sources":["../../src/context/AuthContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAOnG,OAAO,KAAK,EAAqC,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGvG,eAAO,MAAM,WAAW,6CAAyD,CAAC;AAGlF,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoqCpD,CAAC;AAEF,eAAO,MAAM,OAAO,QAAO,gBAM1B,CAAC"}
1
+ {"version":3,"file":"AuthContext.d.ts","sourceRoot":"","sources":["../../src/context/AuthContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAOnG,OAAO,KAAK,EAAqC,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGvG,eAAO,MAAM,WAAW,6CAAyD,CAAC;AAGlF,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkrCpD,CAAC;AAEF,eAAO,MAAM,OAAO,QAAO,gBAM1B,CAAC"}
package/dist/index.esm.js CHANGED
@@ -12806,15 +12806,31 @@ collectionId, enableContactSync, enableInteractionTracking, interactionAppId, in
12806
12806
  // NOW set isVerified - after parent has acknowledged and session is ready
12807
12807
  setIsVerified(true);
12808
12808
  notifyAuthStateChange('LOGIN', authUser, authToken, authAccountData || null, authAccountData || null, true);
12809
- // Sync contact (non-blocking)
12810
- const newContactId = await syncContact(authUser, authAccountData);
12811
- // Track interaction (non-blocking)
12812
- trackInteraction(isNewUser ? 'signup' : 'login', authUser.uid, newContactId, {
12813
- provider: authUser.email ? 'email' : 'phone',
12809
+ // Sync contact + track interaction (truly non-blocking - never block login success)
12810
+ syncContact(authUser, authAccountData)
12811
+ .then((newContactId) => {
12812
+ trackInteraction(isNewUser ? 'signup' : 'login', authUser.uid, newContactId, {
12813
+ provider: authUser.email ? 'email' : 'phone',
12814
+ });
12815
+ })
12816
+ .catch((err) => {
12817
+ console.warn('[AuthContext] Post-login contact sync failed (non-fatal):', err);
12814
12818
  });
12815
12819
  // Optionally preload account info on login (standalone mode only)
12820
+ // NOTE: We call the SDK directly here instead of getAccount(true) because
12821
+ // the memoized getAccount closure still sees token=null (state just set,
12822
+ // not yet committed), which would throw "Not authenticated" spuriously.
12816
12823
  if (!proxyMode && preloadAccountInfo) {
12817
- getAccount(true).catch(() => { });
12824
+ (async () => {
12825
+ try {
12826
+ const fresh = await smartlinks.auth.getAccount();
12827
+ await tokenStorage.saveAccountInfo(fresh, accountCacheTTL);
12828
+ setAccountInfo(fresh);
12829
+ }
12830
+ catch {
12831
+ /* non-fatal preload */
12832
+ }
12833
+ })();
12818
12834
  }
12819
12835
  }
12820
12836
  catch (error) {