@ikonai/sdk-react-ui 1.0.71 → 1.0.72

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.
Files changed (3) hide show
  1. package/ikon-ui.d.ts +3 -0
  2. package/index.js +97 -75
  3. package/package.json +1 -1
package/ikon-ui.d.ts CHANGED
@@ -14,6 +14,8 @@ export declare class IkonUi {
14
14
  private readonly core;
15
15
  private readonly ownsCore;
16
16
  private readonly stores;
17
+ private readonly liveToSeedSurface;
18
+ private readonly adoptedSeedSurfaces;
17
19
  private readonly listeners;
18
20
  private readonly unsubscribeClears;
19
21
  private readonly unsubscribeStoreChanges;
@@ -27,6 +29,7 @@ export declare class IkonUi {
27
29
  subscribeToStyleDeletes(listener: UiStyleDeleteListener): () => void;
28
30
  private handleUiStreamCleared;
29
31
  private syncStreamSnapshot;
32
+ private resolveSurfaceKey;
30
33
  private syncAllStreams;
31
34
  private ensureStoreEntry;
32
35
  private updateCategory;
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IkonUiCore as Sn, UiStreamStore as wn, LiveSnapshotCache as Ut, prefetchBootSnapshot as vn } from "@ikonai/sdk-ui";
2
2
  import { UiStreamStore as Bs } from "@ikonai/sdk-ui";
3
3
  import En, { useSyncExternalStore as ot, useMemo as W, memo as G, useRef as E, useCallback as j, Fragment as Rn, useEffect as C, useState as x, use as st, createContext as Mt, useReducer as An } from "react";
4
- import { createLogger as oe, isInspectModeEnabled as Tn, getOrCreateDeviceId as kn, getSameOriginAuthUrl as Cn, abortSignalTimeout as Dt, deriveAuthUrl as ve, getDebugOverlayParam as In, subscribeToLogEvents as jt, LogLevel as Je, parseUrlParams as _n, clearSessionParamsFromUrl as On, isCloudEnvironment as ht, extractUserIdFromToken as pt, deriveBackendType as mt, IkonClient as xn, AccessDeniedError as Nn, ServerFullError as Ln, AuthenticationError as Pn, isDebugModeEnabled as $t, getLangParam as Un } from "@ikonai/sdk";
4
+ import { createLogger as oe, isInspectModeEnabled as Tn, getOrCreateDeviceId as kn, getSameOriginAuthUrl as Cn, abortSignalTimeout as Dt, deriveAuthUrl as ve, getDebugOverlayParam as _n, subscribeToLogEvents as jt, LogLevel as Je, parseUrlParams as In, clearSessionParamsFromUrl as On, isCloudEnvironment as ht, extractUserIdFromToken as pt, deriveBackendType as mt, IkonClient as xn, AccessDeniedError as Nn, ServerFullError as Ln, AuthenticationError as Pn, isDebugModeEnabled as $t, getLangParam as Un } from "@ikonai/sdk";
5
5
  import { randomUuid as Vs } from "@ikonai/sdk";
6
6
  var Ce = { exports: {} }, ge = {};
7
7
  /**
@@ -64,7 +64,7 @@ function Dn() {
64
64
  return "Suspense";
65
65
  case ee:
66
66
  return "SuspenseList";
67
- case _:
67
+ case I:
68
68
  return "Activity";
69
69
  }
70
70
  if (typeof d == "object")
@@ -241,7 +241,7 @@ React keys must be passed directly to JSX without using spread:
241
241
  function m(d) {
242
242
  return typeof d == "object" && d !== null && d.$$typeof === u;
243
243
  }
244
- var c = En, u = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), R = Symbol.for("react.consumer"), v = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), U = Symbol.for("react.suspense"), ee = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), z = Symbol.for("react.lazy"), _ = Symbol.for("react.activity"), P = Symbol.for("react.client.reference"), M = c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, B = Object.prototype.hasOwnProperty, $ = Array.isArray, V = console.createTask ? console.createTask : function() {
244
+ var c = En, u = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), R = Symbol.for("react.consumer"), v = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), U = Symbol.for("react.suspense"), ee = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), z = Symbol.for("react.lazy"), I = Symbol.for("react.activity"), P = Symbol.for("react.client.reference"), M = c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, B = Object.prototype.hasOwnProperty, $ = Array.isArray, V = console.createTask ? console.createTask : function() {
245
245
  return null;
246
246
  };
247
247
  c = {
@@ -585,6 +585,13 @@ class Qn {
585
585
  core;
586
586
  ownsCore;
587
587
  stores = /* @__PURE__ */ new Map();
588
+ // Boot/live-snapshot remap: render the first live update for a new stream into the existing seed
589
+ // stream's surface (React key), so React reconciles skeleton→live in place instead of unmounting
590
+ // the seed and mounting the live (which flashes white on slow devices before the live tree paints).
591
+ liveToSeedSurface = /* @__PURE__ */ new Map();
592
+ // live stream id -> seed surface key
593
+ adoptedSeedSurfaces = /* @__PURE__ */ new Set();
594
+ // seed surface keys taken over by a live stream
588
595
  listeners = /* @__PURE__ */ new Set();
589
596
  unsubscribeClears;
590
597
  unsubscribeStoreChanges;
@@ -618,21 +625,36 @@ class Qn {
618
625
  return this.core.subscribeToUiStyleDeletes(e);
619
626
  }
620
627
  handleUiStreamCleared = (e) => {
621
- this.stores.delete(e) && this.notify(e);
628
+ const n = this.liveToSeedSurface.get(e);
629
+ if (n) {
630
+ this.liveToSeedSurface.delete(e), this.adoptedSeedSurfaces.delete(n), this.stores.delete(n) && this.notify(n);
631
+ return;
632
+ }
633
+ this.adoptedSeedSurfaces.has(e) || this.stores.delete(e) && this.notify(e);
622
634
  };
623
635
  syncStreamSnapshot = (e) => {
624
636
  const n = this.core.uiStore.getSnapshot(e);
625
- if (!n || !n.rootViewId) {
626
- this.handleUiStreamCleared(e);
627
- return;
628
- }
629
- if (!n.views.get(n.rootViewId)) {
637
+ if (!n || !n.rootViewId || !n.views.get(n.rootViewId)) {
630
638
  this.handleUiStreamCleared(e);
631
639
  return;
632
640
  }
633
- const s = this.ensureStoreEntry(e).store.replaceSnapshot(n), i = this.updateCategory(e, n.category);
634
- (s || i) && this.notify(e);
641
+ const r = this.resolveSurfaceKey(e), s = this.ensureStoreEntry(r).store.replaceSnapshot(n), i = this.updateCategory(r, n.category);
642
+ (s || i) && this.notify(r);
635
643
  };
644
+ // Resolve the surface (React key) a stream renders under. A new live stream adopts an existing,
645
+ // un-adopted seed surface so the boot snapshot → live swap reconciles in place rather than
646
+ // remounting (white flash). Seeds and already-mapped streams keep their own key.
647
+ resolveSurfaceKey(e) {
648
+ const n = this.liveToSeedSurface.get(e);
649
+ if (n)
650
+ return n;
651
+ if (this.stores.has(e) || this.core.isSeedStream(e))
652
+ return e;
653
+ for (const r of this.stores.keys())
654
+ if (this.core.isSeedStream(r) && !this.adoptedSeedSurfaces.has(r))
655
+ return this.liveToSeedSurface.set(e, r), this.adoptedSeedSurfaces.add(r), r;
656
+ return e;
657
+ }
636
658
  syncAllStreams() {
637
659
  const e = this.core.uiStore.getSnapshots(), n = /* @__PURE__ */ new Set();
638
660
  for (const r of e)
@@ -916,7 +938,7 @@ function wt(t) {
916
938
  const e = t.trim();
917
939
  return e.length > 0 ? e : void 0;
918
940
  }
919
- function Ie(t) {
941
+ function _e(t) {
920
942
  if (typeof t == "boolean")
921
943
  return t;
922
944
  if (typeof t == "string") {
@@ -932,13 +954,13 @@ function Sr() {
932
954
  context: r,
933
955
  className: o
934
956
  }) {
935
- const s = Z(r.store, n), i = E(null), a = s ? Ie(s.props?.autoplay) : void 0, l = s ? wt(s.props?.src) : void 0;
957
+ const s = Z(r.store, n), i = E(null), a = s ? _e(s.props?.autoplay) : void 0, l = s ? wt(s.props?.src) : void 0;
936
958
  if (C(() => {
937
959
  a && i.current && i.current.play().catch(() => {
938
960
  });
939
961
  }, [a, l]), !s)
940
962
  return null;
941
- const h = yr(gr(s.props?.className), o), f = wt(s.props?.preload), y = Ie(s.props?.controls), m = Ie(s.props?.loop), c = Ie(s.props?.muted);
963
+ const h = yr(gr(s.props?.className), o), f = wt(s.props?.preload), y = _e(s.props?.controls), m = _e(s.props?.loop), c = _e(s.props?.muted);
942
964
  return /* @__PURE__ */ w.jsx(
943
965
  "audio",
944
966
  {
@@ -1105,19 +1127,19 @@ const Tr = "media", kr = async () => Rr();
1105
1127
  function Cr(t) {
1106
1128
  t.registerModule(Tr, kr);
1107
1129
  }
1108
- const Ir = `#version 300 es
1130
+ const _r = `#version 300 es
1109
1131
  in vec4 a_position;
1110
1132
  void main() {
1111
1133
  gl_Position = a_position;
1112
1134
  }
1113
1135
  `, le = 4;
1114
- function _r(t, e) {
1136
+ function Ir(t, e) {
1115
1137
  return new RegExp(`\\buniform\\s+\\w+\\s+${e}\\s*;`, "g").test(t);
1116
1138
  }
1117
1139
  function Or(t, e) {
1118
1140
  const n = [];
1119
1141
  for (const [r, o] of Object.entries(e)) {
1120
- if (_r(t, r))
1142
+ if (Ir(t, r))
1121
1143
  continue;
1122
1144
  let s;
1123
1145
  switch (o.type) {
@@ -1253,7 +1275,7 @@ class xr {
1253
1275
  }
1254
1276
  compile(e, n = {}) {
1255
1277
  this.lastError = null, this.customUniforms = n, this.currentShaderSource = e;
1256
- const r = this.gl, o = this.compileShader(r.VERTEX_SHADER, Ir);
1278
+ const r = this.gl, o = this.compileShader(r.VERTEX_SHADER, _r);
1257
1279
  if (!o)
1258
1280
  return !1;
1259
1281
  const s = Or(e, n), i = this.compileShader(r.FRAGMENT_SHADER, s);
@@ -1449,10 +1471,10 @@ function Br() {
1449
1471
  isDown: !1
1450
1472
  }), c = s ? Pr(s.props?.shaderSource) : "", u = s ? Ke(s.props?.fps) ?? 60 : 60, g = s?.props?.uniforms, p = W(() => Mr(g), [g]), b = s?.props?.channels, S = W(() => Dr(b), [b]), R = s ? Ur(s.props?.enableMouse) ?? !0 : !0, v = s ? Ke(s.props?.width) : void 0, T = s ? Ke(s.props?.height) : void 0, U = s ? Lr(Nr(s.props?.className), o) : o;
1451
1473
  C(() => {
1452
- const _ = i.current;
1453
- if (_) {
1474
+ const I = i.current;
1475
+ if (I) {
1454
1476
  try {
1455
- const P = new xr(_);
1477
+ const P = new xr(I);
1456
1478
  a.current = P;
1457
1479
  } catch (P) {
1458
1480
  console.error("[ShadertoyRenderer] Failed to create WebGL2 context:", P);
@@ -1462,46 +1484,46 @@ function Br() {
1462
1484
  };
1463
1485
  }
1464
1486
  }, []), C(() => {
1465
- const _ = a.current;
1466
- if (!(!_ || !c) && f.current !== c)
1467
- if (_.compile(c, p))
1487
+ const I = a.current;
1488
+ if (!(!I || !c) && f.current !== c)
1489
+ if (I.compile(c, p))
1468
1490
  f.current = c, y.current = p;
1469
1491
  else {
1470
- const M = _.getError();
1492
+ const M = I.getError();
1471
1493
  console.error("[ShadertoyRenderer] Shader compilation failed:", M);
1472
1494
  }
1473
1495
  }, [c, p]), C(() => {
1474
- const _ = a.current;
1475
- !_ || !f.current || jr(y.current, p) || (_.setCustomUniforms(p), y.current = p);
1496
+ const I = a.current;
1497
+ !I || !f.current || jr(y.current, p) || (I.setCustomUniforms(p), y.current = p);
1476
1498
  }, [p]), C(() => {
1477
- const _ = a.current;
1478
- _ && _.setChannels(S);
1499
+ const I = a.current;
1500
+ I && I.setChannels(S);
1479
1501
  }, [S]), C(() => {
1480
- const _ = a.current;
1481
- if (!_ || !f.current) return;
1502
+ const I = a.current;
1503
+ if (!I || !f.current) return;
1482
1504
  const P = 1e3 / u, M = (B) => {
1483
1505
  const $ = B - h.current;
1484
- $ >= P && (h.current = B - $ % P, _.draw()), l.current = requestAnimationFrame(M);
1506
+ $ >= P && (h.current = B - $ % P, I.draw()), l.current = requestAnimationFrame(M);
1485
1507
  };
1486
1508
  return l.current = requestAnimationFrame(M), () => {
1487
1509
  l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
1488
1510
  };
1489
1511
  }, [u]);
1490
1512
  const ee = j(
1491
- (_) => {
1513
+ (I) => {
1492
1514
  if (!R) return;
1493
1515
  const P = i.current, M = a.current;
1494
1516
  if (!P || !M) return;
1495
- const B = window.devicePixelRatio || 1, $ = P.getBoundingClientRect(), V = (_.clientX - $.left) * B, K = ($.height - (_.clientY - $.top)) * B;
1517
+ const B = window.devicePixelRatio || 1, $ = P.getBoundingClientRect(), V = (I.clientX - $.left) * B, K = ($.height - (I.clientY - $.top)) * B;
1496
1518
  m.current.x = V, m.current.y = K, M.setMouse(V, K, m.current.clickX, m.current.clickY);
1497
1519
  },
1498
1520
  [R]
1499
1521
  ), te = j(
1500
- (_) => {
1522
+ (I) => {
1501
1523
  if (!R) return;
1502
1524
  const P = i.current, M = a.current;
1503
1525
  if (!P || !M) return;
1504
- const B = window.devicePixelRatio || 1, $ = P.getBoundingClientRect(), V = (_.clientX - $.left) * B, K = ($.height - (_.clientY - $.top)) * B;
1526
+ const B = window.devicePixelRatio || 1, $ = P.getBoundingClientRect(), V = (I.clientX - $.left) * B, K = ($.height - (I.clientY - $.top)) * B;
1505
1527
  m.current.isDown = !0, m.current.clickX = V, m.current.clickY = K, M.setMouse(V, K, V, K);
1506
1528
  },
1507
1529
  [R]
@@ -2106,7 +2128,7 @@ const k = {
2106
2128
  ]
2107
2129
  }
2108
2130
  ], nt = k.Letter | k.Word | k.Line | k.Paragraph | k.Emoji, ro = k.Letter | k.Word | k.Line | k.Paragraph, kt = /* @__PURE__ */ new Map(), oo = 16384;
2109
- function Is(t, e) {
2131
+ function _s(t, e) {
2110
2132
  if (!t || t.length > oo)
2111
2133
  return t;
2112
2134
  const n = Eo(e), r = fe(n, k.Emoji), o = n & ro;
@@ -2237,9 +2259,9 @@ function fo(t) {
2237
2259
  return r && e.push(r), e;
2238
2260
  }
2239
2261
  function ho(t, e) {
2240
- return e ? !!(It(t) || It(e) || go(e) || po(e) || mo(e) || _t(t) && _t(e)) : !1;
2262
+ return e ? !!(_t(t) || _t(e) || go(e) || po(e) || mo(e) || It(t) && It(e)) : !1;
2241
2263
  }
2242
- function It(t) {
2264
+ function _t(t) {
2243
2265
  return t.codePointAt(0) === 8205;
2244
2266
  }
2245
2267
  function po(t) {
@@ -2250,7 +2272,7 @@ function mo(t) {
2250
2272
  const e = t.codePointAt(0);
2251
2273
  return e === void 0 ? !1 : e >= 127995 && e <= 127999;
2252
2274
  }
2253
- function _t(t) {
2275
+ function It(t) {
2254
2276
  const e = t.codePointAt(0);
2255
2277
  return e === void 0 ? !1 : e >= 127462 && e <= 127487;
2256
2278
  }
@@ -2468,7 +2490,7 @@ function Co(t) {
2468
2490
  console.warn("Failed to record auto-login attempt in sessionStorage");
2469
2491
  }
2470
2492
  }
2471
- function Io() {
2493
+ function _o() {
2472
2494
  try {
2473
2495
  return sessionStorage.getItem(Ht);
2474
2496
  } catch {
@@ -2527,7 +2549,7 @@ async function Qt(t, e) {
2527
2549
  };
2528
2550
  return he(l), l;
2529
2551
  }
2530
- async function _o({ email: t, spaceId: e, authUrl: n }) {
2552
+ async function Io({ email: t, spaceId: e, authUrl: n }) {
2531
2553
  const r = await fetch(`${n}/email/send`, {
2532
2554
  method: "POST",
2533
2555
  headers: { "Content-Type": "application/json" },
@@ -2961,7 +2983,7 @@ async function Yo(t) {
2961
2983
  };
2962
2984
  }
2963
2985
  const ut = Mt(null);
2964
- function _s({ children: t, config: e }) {
2986
+ function Is({ children: t, config: e }) {
2965
2987
  const [n, r] = x({
2966
2988
  isAuthenticated: !1,
2967
2989
  isLoading: !0,
@@ -2970,7 +2992,7 @@ function _s({ children: t, config: e }) {
2970
2992
  });
2971
2993
  C(() => {
2972
2994
  (() => {
2973
- const m = e.devLoginRunId, c = !!m && Io() === m;
2995
+ const m = e.devLoginRunId, c = !!m && _o() === m;
2974
2996
  m && Co(m);
2975
2997
  const u = No();
2976
2998
  if (u) {
@@ -3087,7 +3109,7 @@ function _s({ children: t, config: e }) {
3087
3109
  if (!e.spaceId)
3088
3110
  throw r((c) => ({ ...c, error: "Space ID is not configured" })), new Error("Space ID is not configured");
3089
3111
  const m = await ve(e.authUrl);
3090
- await _o({ email: y, spaceId: e.spaceId, authUrl: m });
3112
+ await Io({ email: y, spaceId: e.spaceId, authUrl: m });
3091
3113
  },
3092
3114
  [e.authUrl, e.spaceId]
3093
3115
  ), i = j(
@@ -3178,12 +3200,12 @@ function Os(t) {
3178
3200
  }
3179
3201
  const on = (() => {
3180
3202
  try {
3181
- return In();
3203
+ return _n();
3182
3204
  } catch {
3183
3205
  return !1;
3184
3206
  }
3185
3207
  })(), sn = Date.now(), re = [], Xo = 300;
3186
- function _e(t) {
3208
+ function Ie(t) {
3187
3209
  re.push(`[+${((Date.now() - sn) / 1e3).toFixed(1)}s] ${t}`), re.length > Xo && re.shift();
3188
3210
  }
3189
3211
  function Lt(t) {
@@ -3201,21 +3223,21 @@ let Pt = !1;
3201
3223
  function an() {
3202
3224
  if (Pt || typeof window > "u")
3203
3225
  return;
3204
- Pt = !0, window.addEventListener("error", (e) => _e(`window.error: ${e.message} @ ${e.filename ?? "?"}:${e.lineno ?? "?"}:${e.colno ?? "?"}`)), window.addEventListener("unhandledrejection", (e) => _e(`unhandledRejection: ${Lt(e.reason)}`));
3226
+ Pt = !0, window.addEventListener("error", (e) => Ie(`window.error: ${e.message} @ ${e.filename ?? "?"}:${e.lineno ?? "?"}:${e.colno ?? "?"}`)), window.addEventListener("unhandledrejection", (e) => Ie(`unhandledRejection: ${Lt(e.reason)}`));
3205
3227
  const t = console;
3206
3228
  for (const e of ["error", "warn", "log", "info"]) {
3207
3229
  const n = t[e]?.bind(console) ?? (() => {
3208
3230
  });
3209
3231
  t[e] = (...r) => {
3210
3232
  try {
3211
- _e(`console.${e}: ${r.map(Lt).join(" ")}`);
3233
+ Ie(`console.${e}: ${r.map(Lt).join(" ")}`);
3212
3234
  } catch {
3213
3235
  }
3214
3236
  n(...r);
3215
3237
  };
3216
3238
  }
3217
3239
  try {
3218
- jt((e) => _e(`${e.levelName} [${e.component}] ${e.message}`), { minLevel: Je.DEBUG });
3240
+ jt((e) => Ie(`${e.levelName} [${e.component}] ${e.message}`), { minLevel: Je.DEBUG });
3219
3241
  } catch {
3220
3242
  }
3221
3243
  }
@@ -3356,28 +3378,28 @@ function Qo() {
3356
3378
  return window.__IKON_LOCAL_IKON_SERVER_CONFIG__;
3357
3379
  }
3358
3380
  function Ns(t) {
3359
- const { authConfig: e, modules: n, timeouts: r, backgroundAudio: o, webRtc: s, audio: i, video: a, websocket: l, webtransport: h, proxy: f, liveSnapshot: y, bootSnapshot: m } = t, c = e === void 0 ? Zo() ?? null : e, u = Qo(), g = zo(), p = E(null), b = E(null), S = E(null), R = E(!1), v = E(!1), T = E(o), U = E(r), ee = E(s), te = E(i), z = E(a), _ = E(l), P = E(h), M = E(f), B = E(y), $ = E(m), V = E("local"), K = E(void 0);
3360
- T.current = o, U.current = r, ee.current = s, te.current = i, z.current = a, _.current = l, P.current = h, M.current = f, B.current = y, $.current = m;
3381
+ const { authConfig: e, modules: n, timeouts: r, backgroundAudio: o, webRtc: s, audio: i, video: a, websocket: l, webtransport: h, proxy: f, liveSnapshot: y, bootSnapshot: m } = t, c = e === void 0 ? Zo() ?? null : e, u = Qo(), g = zo(), p = E(null), b = E(null), S = E(null), R = E(!1), v = E(!1), T = E(o), U = E(r), ee = E(s), te = E(i), z = E(a), I = E(l), P = E(h), M = E(f), B = E(y), $ = E(m), V = E("local"), K = E(void 0);
3382
+ T.current = o, U.current = r, ee.current = s, te.current = i, z.current = a, I.current = l, P.current = h, M.current = f, B.current = y, $.current = m;
3361
3383
  const [H, Ee] = x("connecting"), [Re, pe] = x(!1), [d, A] = x(!1), [O, N] = x(null), [se, me] = x(null), [L, Q] = x(!1), [ie, Me] = x(null), [ae, un] = x(null), [De, dt] = x(!1), je = E(!1), [dn, fn] = x(0), Y = W(() => {
3362
3384
  try {
3363
- const I = _n();
3364
- return (I.sessionId || I.channelKey) && On(), I;
3385
+ const _ = In();
3386
+ return (_.sessionId || _.channelKey) && On(), _;
3365
3387
  } catch {
3366
3388
  return { parameters: {} };
3367
3389
  }
3368
3390
  }, []);
3369
3391
  m !== !1 && vn();
3370
3392
  const ce = W(() => c?.enabled ? Jt() : null, [c?.enabled, dn]), Ae = u?.enabled ?? !1, $e = u?.host ?? "localhost", Be = u?.port ?? 8443, Fe = !!c && !c.enabled && !!c.spaceId && (ht() || Ae);
3371
- Fe && !ae && !De && !je.current && (je.current = !0, ve(c.authUrl).then((I) => Qt(c.spaceId, I)).then((I) => {
3372
- un(I.token), dt(!0);
3373
- }).catch((I) => {
3374
- Oe.error("Anonymous auth failed:", I), je.current = !1, Ae ? dt(!0) : N(I instanceof Error ? I.message : "Anonymous auth failed");
3393
+ Fe && !ae && !De && !je.current && (je.current = !0, ve(c.authUrl).then((_) => Qt(c.spaceId, _)).then((_) => {
3394
+ un(_.token), dt(!0);
3395
+ }).catch((_) => {
3396
+ Oe.error("Anonymous auth failed:", _), je.current = !1, Ae ? dt(!0) : N(_ instanceof Error ? _.message : "Anonymous auth failed");
3375
3397
  }));
3376
3398
  const Ve = W(() => {
3377
3399
  if (Ae) {
3378
3400
  if (Fe && !De)
3379
3401
  return null;
3380
- const I = ce?.token ?? ae ?? void 0, q = I ? pt(I) ?? void 0 : void 0;
3402
+ const _ = ce?.token ?? ae ?? void 0, q = _ ? pt(_) ?? void 0 : void 0;
3381
3403
  return {
3382
3404
  local: {
3383
3405
  host: $e,
@@ -3425,15 +3447,15 @@ function Ns(t) {
3425
3447
  C(() => {
3426
3448
  if (!R.current) {
3427
3449
  if (R.current = !0, S.current = Yr(), n)
3428
- for (const I of n)
3429
- I(S.current);
3430
- S.current.loadRegisteredModules().catch((I) => {
3431
- Oe.error("Failed to load UI modules", I);
3450
+ for (const _ of n)
3451
+ _(S.current);
3452
+ S.current.loadRegisteredModules().catch((_) => {
3453
+ Oe.error("Failed to load UI modules", _);
3432
3454
  });
3433
3455
  }
3434
3456
  }, []), C(() => {
3435
3457
  if (!Ve) return;
3436
- const I = new xn({
3458
+ const _ = new xn({
3437
3459
  ...Ve,
3438
3460
  timeouts: U.current,
3439
3461
  audio: te.current !== void 0 || T.current ? {
@@ -3443,7 +3465,7 @@ function Ns(t) {
3443
3465
  video: z.current !== void 0 ? { enabled: z.current } : void 0,
3444
3466
  mediaSession: { title: document.title || void 0, artist: document.title || void 0 },
3445
3467
  webRtc: ee.current === !1 ? { enabled: !1 } : void 0,
3446
- websocket: _.current,
3468
+ websocket: I.current,
3447
3469
  webtransport: P.current,
3448
3470
  proxy: M.current,
3449
3471
  onConnectionStateChange: (J) => {
@@ -3453,13 +3475,13 @@ function Ns(t) {
3453
3475
  N(J.message);
3454
3476
  }
3455
3477
  });
3456
- p.current = I;
3457
- const q = B.current ?? !0, Te = K.current, ft = Te ? pt(Te) ?? null : null, gn = q && ft ? { enabled: !0, appId: V.current, userId: ft } : void 0, ke = new Qn({ client: I, liveSnapshot: gn, bootSnapshot: $.current });
3478
+ p.current = _;
3479
+ const q = B.current ?? !0, Te = K.current, ft = Te ? pt(Te) ?? null : null, gn = q && ft ? { enabled: !0, appId: V.current, userId: ft } : void 0, ke = new Qn({ client: _, liveSnapshot: gn, bootSnapshot: $.current });
3458
3480
  b.current = ke, Me(ke), A(!1);
3459
3481
  const yn = ke.subscribeToUiUpdates(() => {
3460
3482
  A(!0);
3461
3483
  });
3462
- return I.connect().catch((J) => {
3484
+ return _.connect().catch((J) => {
3463
3485
  if (Oe.error("Connection failed:", J), J instanceof Nn) {
3464
3486
  me(J.reason);
3465
3487
  return;
@@ -3470,19 +3492,19 @@ function Ns(t) {
3470
3492
  }
3471
3493
  J instanceof Pn && !v.current && (v.current = !0, Oe.warn("Auth session appears stale, clearing and retrying"), Ut.clearAll(), g ? g.logout() : (Le(), fn((bn) => bn + 1)));
3472
3494
  }), () => {
3473
- yn(), I.disconnect(), p.current = null, ke.dispose(), b.current = null;
3495
+ yn(), _.disconnect(), p.current = null, ke.dispose(), b.current = null;
3474
3496
  };
3475
3497
  }, [Ve]);
3476
- const pn = j((I, q) => {
3498
+ const pn = j((_, q) => {
3477
3499
  const Te = typeof q == "string" ? q : JSON.stringify(q ?? {});
3478
- p.current?.sendActionCall(I, Te);
3500
+ p.current?.sendActionCall(_, Te);
3479
3501
  }, []);
3480
3502
  C(() => {
3481
3503
  if (H !== "connecting") {
3482
3504
  pe(!1);
3483
3505
  return;
3484
3506
  }
3485
- const I = p.current?.slowConnectionThresholdMs ?? 5e3, q = setTimeout(() => pe(!0), I);
3507
+ const _ = p.current?.slowConnectionThresholdMs ?? 5e3, q = setTimeout(() => pe(!0), _);
3486
3508
  return () => clearTimeout(q);
3487
3509
  }, [H]);
3488
3510
  const mn = H === "connected" || H === "reconnecting", We = d && H !== "offline";
@@ -3788,7 +3810,7 @@ function Ds() {
3788
3810
  return t;
3789
3811
  }
3790
3812
  export {
3791
- _s as AuthProvider,
3813
+ Is as AuthProvider,
3792
3814
  xs as ConnectionStateRenderer,
3793
3815
  on as DEBUG_OVERLAY_ENABLED,
3794
3816
  cn as DebugOverlay,
@@ -3830,9 +3852,9 @@ export {
3830
3852
  Cr as registerMediaModule,
3831
3853
  Wr as registerShadertoyModule,
3832
3854
  Gn as renderChildren,
3833
- Is as renderMotionLetters,
3855
+ _s as renderMotionLetters,
3834
3856
  he as saveAuthSession,
3835
- _o as sendLoginCode,
3857
+ Io as sendLoginCode,
3836
3858
  ne as sessionToUser,
3837
3859
  Go as useAuth,
3838
3860
  Os as useAuthGuard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonai/sdk-react-ui",
3
- "version": "1.0.71",
3
+ "version": "1.0.72",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",