@blinkdotnew/dev-sdk 2.1.5 → 2.1.6

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.d.mts CHANGED
@@ -1161,10 +1161,6 @@ declare class BlinkAuth {
1161
1161
  * Redirect to Blink auth page
1162
1162
  */
1163
1163
  login(nextUrl?: string): void;
1164
- /**
1165
- * Set up listener for tokens from parent window (for iframe OAuth delegation)
1166
- */
1167
- private setupParentTokenListener;
1168
1164
  /**
1169
1165
  * Logout and clear stored tokens
1170
1166
  */
package/dist/index.d.ts CHANGED
@@ -1161,10 +1161,6 @@ declare class BlinkAuth {
1161
1161
  * Redirect to Blink auth page
1162
1162
  */
1163
1163
  login(nextUrl?: string): void;
1164
- /**
1165
- * Set up listener for tokens from parent window (for iframe OAuth delegation)
1166
- */
1167
- private setupParentTokenListener;
1168
1164
  /**
1169
1165
  * Logout and clear stored tokens
1170
1166
  */
package/dist/index.js CHANGED
@@ -1464,52 +1464,14 @@ var BlinkAuth = class {
1464
1464
  console.warn("Failed to parse redirect URL:", e);
1465
1465
  }
1466
1466
  }
1467
- if (isWeb && this.isIframe && hasWindow() && window.parent !== window) {
1468
- console.log("\u{1F5BC}\uFE0F In iframe, delegating login to parent window");
1469
- this.setupParentTokenListener();
1470
- window.parent.postMessage({
1471
- type: "BLINK_AUTH_LOGIN_REQUEST",
1472
- projectId: this.config.projectId,
1473
- redirectUrl: redirectUrl || "",
1474
- authUrl: this.authUrl
1475
- }, "*");
1476
- return;
1477
- }
1478
1467
  const authUrl = new URL("/auth", this.authUrl);
1479
1468
  authUrl.searchParams.set("redirect_url", redirectUrl || "");
1480
1469
  if (this.config.projectId) {
1481
1470
  authUrl.searchParams.set("project_id", this.config.projectId);
1482
1471
  }
1472
+ authUrl.searchParams.set("prompt", "select_account");
1483
1473
  window.location.href = authUrl.toString();
1484
1474
  }
1485
- /**
1486
- * Set up listener for tokens from parent window (for iframe OAuth delegation)
1487
- */
1488
- setupParentTokenListener() {
1489
- if (typeof window === "undefined") return;
1490
- const messageListener = (event) => {
1491
- const { type, access_token, refresh_token, expires_in, refresh_expires_in, issued_at, projectId, error } = event.data || {};
1492
- if (type === "BLINK_AUTH_TOKENS") {
1493
- if (projectId && projectId !== this.config.projectId) {
1494
- return;
1495
- }
1496
- console.log("\u{1F4E5} Received auth tokens from parent window");
1497
- window.removeEventListener("message", messageListener);
1498
- this.setTokens({
1499
- access_token,
1500
- refresh_token,
1501
- token_type: "Bearer",
1502
- expires_in: expires_in || 3600,
1503
- refresh_expires_in,
1504
- issued_at: issued_at || Math.floor(Date.now() / 1e3)
1505
- }, true);
1506
- } else if (type === "BLINK_AUTH_ERROR") {
1507
- window.removeEventListener("message", messageListener);
1508
- console.error("Auth error from parent:", error);
1509
- }
1510
- };
1511
- window.addEventListener("message", messageListener);
1512
- }
1513
1475
  /**
1514
1476
  * Logout and clear stored tokens
1515
1477
  */
package/dist/index.mjs CHANGED
@@ -1462,52 +1462,14 @@ var BlinkAuth = class {
1462
1462
  console.warn("Failed to parse redirect URL:", e);
1463
1463
  }
1464
1464
  }
1465
- if (isWeb && this.isIframe && hasWindow() && window.parent !== window) {
1466
- console.log("\u{1F5BC}\uFE0F In iframe, delegating login to parent window");
1467
- this.setupParentTokenListener();
1468
- window.parent.postMessage({
1469
- type: "BLINK_AUTH_LOGIN_REQUEST",
1470
- projectId: this.config.projectId,
1471
- redirectUrl: redirectUrl || "",
1472
- authUrl: this.authUrl
1473
- }, "*");
1474
- return;
1475
- }
1476
1465
  const authUrl = new URL("/auth", this.authUrl);
1477
1466
  authUrl.searchParams.set("redirect_url", redirectUrl || "");
1478
1467
  if (this.config.projectId) {
1479
1468
  authUrl.searchParams.set("project_id", this.config.projectId);
1480
1469
  }
1470
+ authUrl.searchParams.set("prompt", "select_account");
1481
1471
  window.location.href = authUrl.toString();
1482
1472
  }
1483
- /**
1484
- * Set up listener for tokens from parent window (for iframe OAuth delegation)
1485
- */
1486
- setupParentTokenListener() {
1487
- if (typeof window === "undefined") return;
1488
- const messageListener = (event) => {
1489
- const { type, access_token, refresh_token, expires_in, refresh_expires_in, issued_at, projectId, error } = event.data || {};
1490
- if (type === "BLINK_AUTH_TOKENS") {
1491
- if (projectId && projectId !== this.config.projectId) {
1492
- return;
1493
- }
1494
- console.log("\u{1F4E5} Received auth tokens from parent window");
1495
- window.removeEventListener("message", messageListener);
1496
- this.setTokens({
1497
- access_token,
1498
- refresh_token,
1499
- token_type: "Bearer",
1500
- expires_in: expires_in || 3600,
1501
- refresh_expires_in,
1502
- issued_at: issued_at || Math.floor(Date.now() / 1e3)
1503
- }, true);
1504
- } else if (type === "BLINK_AUTH_ERROR") {
1505
- window.removeEventListener("message", messageListener);
1506
- console.error("Auth error from parent:", error);
1507
- }
1508
- };
1509
- window.addEventListener("message", messageListener);
1510
- }
1511
1473
  /**
1512
1474
  * Logout and clear stored tokens
1513
1475
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/dev-sdk",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Blink TypeScript SDK for client-side applications - Zero-boilerplate CRUD + auth + AI + analytics + notifications for modern SaaS/AI apps",
5
5
  "keywords": [
6
6
  "blink",