@blade-hq/agent-client 1.2.1-beta.5 → 1.2.1-beta.7

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
@@ -45,8 +45,8 @@ async function loginWithPopup(client, options = {}) {
45
45
  authorizeUrl.searchParams.set("client_origin", clientOrigin);
46
46
  authorizeUrl.searchParams.set("state", state);
47
47
  const popup = window.open(
48
- authorizeUrl.toString(),
49
- "blade-sdk-login",
48
+ "about:blank",
49
+ `blade-sdk-login-${state}`,
50
50
  `popup=yes,width=${width},height=${height},left=${left},top=${top}`
51
51
  );
52
52
  if (!popup) {
@@ -69,6 +69,7 @@ async function loginWithPopup(client, options = {}) {
69
69
  };
70
70
  const onMessage = (event) => {
71
71
  if (event.origin !== expectedOrigin) return;
72
+ if (event.source !== popup) return;
72
73
  if (!isAuthCallbackMessage(event.data)) return;
73
74
  if (event.data.state !== state) return;
74
75
  const message = event.data;
@@ -107,6 +108,7 @@ async function loginWithPopup(client, options = {}) {
107
108
  settle(() => reject(new Error("\u767B\u5F55\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002")));
108
109
  }, timeoutMs);
109
110
  window.addEventListener("message", onMessage);
111
+ popup.location.replace(authorizeUrl.toString());
110
112
  });
111
113
  }
112
114
 
@@ -4129,7 +4131,7 @@ function resolveAuthToken(options) {
4129
4131
 
4130
4132
  // src/version.ts
4131
4133
  var SDK_NAME = "agent-client";
4132
- var SDK_VERSION = true ? "1.2.1-beta.5" : "1.1.1";
4134
+ var SDK_VERSION = true ? "1.2.1-beta.7" : "1.1.1";
4133
4135
 
4134
4136
  // src/socket.ts
4135
4137
  function withSdkIdentity(auth) {