@pollar/core 0.4.2 → 0.4.4
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 +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1122,6 +1122,7 @@ function withSignal(promise, signal) {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
async function login(options, deps) {
|
|
1124
1124
|
const { api, basePath, apiKey, signal, emitState, storeSession, clearSession } = deps;
|
|
1125
|
+
const oauthPopup = options.provider === "google" || options.provider === "github" ? window.open("about:blank", "_blank") : null;
|
|
1125
1126
|
emitState("authentication", STATE_VAR_CODES.authentication.CREATE_SESSION_START, "info", StateStatus.LOADING);
|
|
1126
1127
|
const createSessionResponse = await api.POST("/auth/session", { signal });
|
|
1127
1128
|
if (!emitResponse(
|
|
@@ -1131,6 +1132,7 @@ async function login(options, deps) {
|
|
|
1131
1132
|
STATE_VAR_CODES.authentication.CREATE_SESSION_ERROR,
|
|
1132
1133
|
emitState
|
|
1133
1134
|
)) {
|
|
1135
|
+
oauthPopup?.close();
|
|
1134
1136
|
return;
|
|
1135
1137
|
}
|
|
1136
1138
|
const clientSessionId = createSessionResponse.data.content.clientSessionId;
|
|
@@ -1160,7 +1162,11 @@ async function login(options, deps) {
|
|
|
1160
1162
|
url.searchParams.set("api_key", apiKey);
|
|
1161
1163
|
url.searchParams.set("client_session_id", clientSessionId);
|
|
1162
1164
|
url.searchParams.set("redirect_uri", window.location.origin);
|
|
1163
|
-
|
|
1165
|
+
if (oauthPopup) {
|
|
1166
|
+
oauthPopup.location.href = url.toString();
|
|
1167
|
+
} else {
|
|
1168
|
+
window.open(url.toString(), "_blank");
|
|
1169
|
+
}
|
|
1164
1170
|
break;
|
|
1165
1171
|
}
|
|
1166
1172
|
case "wallet": {
|