@ikonai/sdk 1.3.4 → 1.3.5

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/index.js CHANGED
@@ -3170,7 +3170,7 @@ function Xd() {
3170
3170
  }
3171
3171
  //#endregion
3172
3172
  //#region src/utils/embedded-oauth.ts
3173
- var Zd = C("EmbeddedAuth"), Qd = "/oauth/popup-callback", $d = "ikon-oauth-embedder-request", ef = "ikon_pkce", tf = 1500, nf = 3e5;
3173
+ var Zd = C("EmbeddedAuth"), Qd = "/oauth/popup-callback", $d = "ikon-oauth-embedder-request", ef = "ikon_pkce", tf = 800, nf = 3e5;
3174
3174
  function rf() {
3175
3175
  if (typeof window > "u") return !1;
3176
3176
  try {
@@ -3201,11 +3201,10 @@ async function af(e, t) {
3201
3201
  });
3202
3202
  }
3203
3203
  async function of(e, t) {
3204
- let n = window.open("about:blank", "ikon-oauth", "popup,width=520,height=680");
3205
- if (await af(e, t)) return n?.close(), !0;
3204
+ if (await af(e, t)) return !0;
3206
3205
  try {
3207
- let { code: r, provider: i } = await sf(n, e, t), a = new URL(window.location.href);
3208
- return a.searchParams.set("ikon_code", r), a.searchParams.set("ikon_provider", i), window.location.replace(a.toString()), !0;
3206
+ let { code: n, provider: r } = await sf(window.open("about:blank", "ikon-oauth", "popup,width=520,height=680"), e, t), i = new URL(window.location.href);
3207
+ return i.searchParams.set("ikon_code", n), i.searchParams.set("ikon_provider", r), window.location.replace(i.toString()), !0;
3209
3208
  } catch (t) {
3210
3209
  return Zd.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
3211
3210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonai/sdk",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -34,9 +34,11 @@ export declare function isEmbedded(): boolean;
34
34
  * Asks the embedder first, because a host that is cross-origin isolated severs any popup this frame
35
35
  * opens. Falls back to the popup for a host that is not.
36
36
  *
37
- * The window is opened BEFORE either path is chosen, while the click is still what the browser sees:
38
- * asking the embedder awaits, and a popup opened after that has lost the gesture and is taken for a
39
- * pop-under. An embedder that claims the request gets it closed again immediately.
37
+ * The popup is opened only once the embedder has declined, never speculatively. Opening it up front
38
+ * left a blank window stranded on screen in exactly the case the embedder path handles: a severed
39
+ * `window.open` returns null, so there is no handle left to close the window it nonetheless opened.
40
+ * The gesture survives the wait — {@link EMBEDDER_ACK_TIMEOUT_MS} is bounded well inside the
41
+ * browser's transient-activation window, so the popup is still attributable to the click.
40
42
  *
41
43
  * The code is handed over by reloading this document with `ikon_code` on it rather than by redeeming
42
44
  * it here: that is the exact shape the unframed redirect flow already produces, so the callback