@block-auth.io/core 0.13.0 → 0.13.1

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
@@ -3803,6 +3803,13 @@ function createAuthRuntime(client, callbacks = {}) {
3803
3803
  );
3804
3804
  });
3805
3805
  };
3806
+ const onSocketReconnect = () => {
3807
+ if (stopped || hookState.isLoggingOut || !hookState.isSigned) return;
3808
+ const externalService = browserBase.getExternalService();
3809
+ const did = externalService.service && externalService.service !== "blockauth" ? externalService.did : browserBase.getSession().did;
3810
+ if (!did) return;
3811
+ emitSdkSign(wsc().accessToken, did);
3812
+ };
3806
3813
  const onSdkUserRolesChanged = async (data) => {
3807
3814
  const { success, message } = data || {};
3808
3815
  if (!success || !message?.address) return;
@@ -3912,6 +3919,7 @@ function createAuthRuntime(client, callbacks = {}) {
3912
3919
  wsc().on("sdk:user:roles:changed", onSdkUserRolesChanged);
3913
3920
  wsc().on("sdk:restore", onSdkRestore);
3914
3921
  wsc().ws?.onAny(onAnyServerEvent);
3922
+ wsc().ws?.on("connect", onSocketReconnect);
3915
3923
  if (typeof window !== "undefined") {
3916
3924
  window.addEventListener("storage", onStorageLogout);
3917
3925
  }
@@ -3961,6 +3969,7 @@ function createAuthRuntime(client, callbacks = {}) {
3961
3969
  w.off("sdk:user:roles:changed", onSdkUserRolesChanged);
3962
3970
  w.off("sdk:restore", onSdkRestore);
3963
3971
  w.ws?.offAny(onAnyServerEvent);
3972
+ w.ws?.off("connect", onSocketReconnect);
3964
3973
  }
3965
3974
  if (typeof window !== "undefined") {
3966
3975
  window.removeEventListener("storage", onStorageLogout);