@ikonai/sdk-react-ui 1.3.6 → 1.3.8

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 (2) hide show
  1. package/index.js +27 -27
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3070,9 +3070,9 @@ function ii({ children: e, config: n }) {
3070
3070
  isLoading: !0,
3071
3071
  user: null,
3072
3072
  error: null
3073
- }), a = n.methods.includes("email"), o = !n.requireSignIn || n.methods.includes("guest") || n.methods.includes("global"), s = j(!1), c = j(!1), l = j(!1), u = O(async (e) => {
3074
- if (!l.current) {
3075
- l.current = !0;
3073
+ }), a = n.methods.includes("email"), o = !n.requireSignIn || n.methods.includes("guest") || n.methods.includes("global"), s = j(!1), c = j(!1), l = O(async (e) => {
3074
+ if (!c.current) {
3075
+ c.current = !0;
3076
3076
  try {
3077
3077
  let t = await kr(e);
3078
3078
  if (t === null) {
@@ -3091,7 +3091,7 @@ function ii({ children: e, config: n }) {
3091
3091
  error: null
3092
3092
  });
3093
3093
  } catch {} finally {
3094
- l.current = !1;
3094
+ c.current = !1;
3095
3095
  }
3096
3096
  }
3097
3097
  }, []);
@@ -3214,7 +3214,7 @@ function ii({ children: e, config: n }) {
3214
3214
  o
3215
3215
  ]), k(() => {
3216
3216
  if (n.spaceId) return E(n.spaceId, (e) => {
3217
- c.current || (c.current = !0, s.current = !0, e.codeVerifier && fe(e.codeVerifier), Or(e.code, e.provider, n.authUrl).then((e) => {
3217
+ s.current = !0, e.codeVerifier && fe(e.codeVerifier), Or(e.code, e.provider, n.authUrl).then((e) => {
3218
3218
  i({
3219
3219
  isAuthenticated: !0,
3220
3220
  isLoading: !1,
@@ -3228,21 +3228,21 @@ function ii({ children: e, config: n }) {
3228
3228
  user: null,
3229
3229
  error: e instanceof Error ? e.message : "Could not complete the sign-in"
3230
3230
  });
3231
- }));
3231
+ });
3232
3232
  });
3233
3233
  }, [n.spaceId, n.authUrl]), k(() => {
3234
3234
  let e = r.user?.expiresAt;
3235
3235
  if (!e) return;
3236
3236
  let t = ur();
3237
3237
  if (!t) return;
3238
- let n = Date.parse(e) - ri, i = setTimeout(() => void u(t), Math.max(0, n - Date.now())), a = () => {
3239
- document.visibilityState === "visible" && Date.now() >= n && u(t);
3238
+ let n = Date.parse(e) - ri, i = setTimeout(() => void l(t), Math.max(0, n - Date.now())), a = () => {
3239
+ document.visibilityState === "visible" && Date.now() >= n && l(t);
3240
3240
  };
3241
3241
  return document.addEventListener("visibilitychange", a), () => {
3242
3242
  clearTimeout(i), document.removeEventListener("visibilitychange", a);
3243
3243
  };
3244
- }, [r.user?.expiresAt, u]);
3245
- let d = O(async (e) => {
3244
+ }, [r.user?.expiresAt, l]);
3245
+ let u = O(async (e) => {
3246
3246
  if (!n.spaceId) {
3247
3247
  i((e) => ({
3248
3248
  ...e,
@@ -3316,7 +3316,7 @@ function ii({ children: e, config: n }) {
3316
3316
  return;
3317
3317
  }
3318
3318
  window.location.href = await Fr(e, n.spaceId, t);
3319
- }, [n.authUrl, n.spaceId]), f = O(async (e) => {
3319
+ }, [n.authUrl, n.spaceId]), d = O(async (e) => {
3320
3320
  if (!n.spaceId) throw i((e) => ({
3321
3321
  ...e,
3322
3322
  error: "Space ID is not configured"
@@ -3327,7 +3327,7 @@ function ii({ children: e, config: n }) {
3327
3327
  spaceId: n.spaceId,
3328
3328
  authUrl: t
3329
3329
  });
3330
- }, [n.authUrl, n.spaceId]), p = O(async (e, t) => {
3330
+ }, [n.authUrl, n.spaceId]), f = O(async (e, t) => {
3331
3331
  i((e) => ({
3332
3332
  ...e,
3333
3333
  isLoading: !0,
@@ -3353,7 +3353,7 @@ function ii({ children: e, config: n }) {
3353
3353
  error: t
3354
3354
  })), e;
3355
3355
  }
3356
- }, [n.authUrl]), m = O(() => {
3356
+ }, [n.authUrl]), p = O(() => {
3357
3357
  let e = r.user?.token;
3358
3358
  e && Br(e, n.authUrl), hr(), fr(), t.clearAll(), i({
3359
3359
  isAuthenticated: !1,
@@ -3361,7 +3361,7 @@ function ii({ children: e, config: n }) {
3361
3361
  user: null,
3362
3362
  error: null
3363
3363
  });
3364
- }, [r.user?.token, n.authUrl]), h = O(async (e) => {
3364
+ }, [r.user?.token, n.authUrl]), m = O(async (e) => {
3365
3365
  let t = await S(n.authUrl);
3366
3366
  i((e) => ({
3367
3367
  ...e,
@@ -3383,25 +3383,25 @@ function ii({ children: e, config: n }) {
3383
3383
  error: e instanceof Error ? e.message : "Passkey registration failed"
3384
3384
  }));
3385
3385
  }
3386
- }, [n.authUrl]), g = O(() => r.user?.token ?? null, [r.user]), _ = A(() => ({
3386
+ }, [n.authUrl]), h = O(() => r.user?.token ?? null, [r.user]), g = A(() => ({
3387
3387
  state: r,
3388
- login: d,
3389
- logout: m,
3390
- getToken: g,
3391
- registerPasskey: h,
3392
- requestEmailCode: f,
3393
- submitEmailCode: p
3388
+ login: u,
3389
+ logout: p,
3390
+ getToken: h,
3391
+ registerPasskey: m,
3392
+ requestEmailCode: d,
3393
+ submitEmailCode: f
3394
3394
  }), [
3395
3395
  r,
3396
- d,
3397
- m,
3398
- g,
3396
+ u,
3397
+ p,
3399
3398
  h,
3400
- f,
3401
- p
3399
+ m,
3400
+ d,
3401
+ f
3402
3402
  ]);
3403
3403
  return /* @__PURE__ */ F(ni, {
3404
- value: _,
3404
+ value: g,
3405
3405
  children: e
3406
3406
  });
3407
3407
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonai/sdk-react-ui",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",