@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.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3811,6 +3811,13 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3811
3811
|
);
|
|
3812
3812
|
});
|
|
3813
3813
|
};
|
|
3814
|
+
const onSocketReconnect = () => {
|
|
3815
|
+
if (stopped || hookState.isLoggingOut || !hookState.isSigned) return;
|
|
3816
|
+
const externalService = browserBase.getExternalService();
|
|
3817
|
+
const did = externalService.service && externalService.service !== "blockauth" ? externalService.did : browserBase.getSession().did;
|
|
3818
|
+
if (!did) return;
|
|
3819
|
+
emitSdkSign(wsc().accessToken, did);
|
|
3820
|
+
};
|
|
3814
3821
|
const onSdkUserRolesChanged = async (data) => {
|
|
3815
3822
|
const { success, message } = data || {};
|
|
3816
3823
|
if (!success || !message?.address) return;
|
|
@@ -3920,6 +3927,7 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3920
3927
|
wsc().on("sdk:user:roles:changed", onSdkUserRolesChanged);
|
|
3921
3928
|
wsc().on("sdk:restore", onSdkRestore);
|
|
3922
3929
|
wsc().ws?.onAny(onAnyServerEvent);
|
|
3930
|
+
wsc().ws?.on("connect", onSocketReconnect);
|
|
3923
3931
|
if (typeof window !== "undefined") {
|
|
3924
3932
|
window.addEventListener("storage", onStorageLogout);
|
|
3925
3933
|
}
|
|
@@ -3969,6 +3977,7 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3969
3977
|
w.off("sdk:user:roles:changed", onSdkUserRolesChanged);
|
|
3970
3978
|
w.off("sdk:restore", onSdkRestore);
|
|
3971
3979
|
w.ws?.offAny(onAnyServerEvent);
|
|
3980
|
+
w.ws?.off("connect", onSocketReconnect);
|
|
3972
3981
|
}
|
|
3973
3982
|
if (typeof window !== "undefined") {
|
|
3974
3983
|
window.removeEventListener("storage", onStorageLogout);
|