@zerodev/wallet-react-ui 0.0.2 → 0.0.3

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.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { jsxs as d, jsx as t, Fragment as b } from "react/jsx-runtime";
2
- import { useId as D, useState as w, useEffect as P, useMemo as ie, useRef as K } from "react";
3
- import { useStore as O, create as se } from "zustand";
4
- import { cn as R, IconButton as q, Text as h, Icon as X, Button as C, Wrapper as ae, ListItem as Y, Input as de } from "@zerodev/react-ui";
5
- import { useConfig as le, useConnect as ce } from "wagmi";
6
- import { useSendMagicLink as J, useSendOTP as Q, useVerifyOTP as ue, useAuthenticateOAuth as pe, useRegisterPasskey as fe, useLoginPasskey as he, useVerifyMagicLink as ze, zeroDevWallet as me, NotAuthenticatedError as ge } from "@zerodev/wallet-react";
7
- import { subscribeWithSelector as ye } from "zustand/middleware";
2
+ import { useId as V, useState as w, useEffect as P, useMemo as re, useRef as K } from "react";
3
+ import { useStore as O, create as ie } from "zustand";
4
+ import { cn as R, IconButton as q, Text as h, ZeroDevLogo as se, Button as C, Wrapper as ae, ListItem as X, Input as de, Icon as le } from "@zerodev/react-ui";
5
+ import { useConfig as ce, useConnect as ue } from "wagmi";
6
+ import { useSendMagicLink as Y, useSendOTP as J, useVerifyOTP as pe, useAuthenticateOAuth as fe, useRegisterPasskey as he, useLoginPasskey as ze, useVerifyMagicLink as me, zeroDevWallet as ge, NotAuthenticatedError as ye } from "@zerodev/wallet-react";
7
+ import { subscribeWithSelector as xe } from "zustand/middleware";
8
8
  const Z = 52;
9
- function xe({
9
+ function we({
10
10
  onBack: e,
11
11
  onClose: i,
12
12
  title: r,
@@ -30,7 +30,7 @@ function xe({
30
30
  }
31
31
  );
32
32
  }
33
- function we({
33
+ function ve({
34
34
  layer: e,
35
35
  rect: i
36
36
  }) {
@@ -69,14 +69,14 @@ function we({
69
69
  )
70
70
  ] });
71
71
  }
72
- const ve = "-6 -6 412 812";
73
- function Ne() {
72
+ const Ne = "-6 -6 412 812";
73
+ function Se() {
74
74
  return /* @__PURE__ */ t("div", { className: "zd:absolute zd:inset-0 zd:z-0 zd:rounded-4xl zd:pointer-events-none", children: /* @__PURE__ */ t(
75
75
  "svg",
76
76
  {
77
77
  width: "100%",
78
78
  height: "100%",
79
- viewBox: ve,
79
+ viewBox: Ne,
80
80
  preserveAspectRatio: "none",
81
81
  role: "img",
82
82
  "aria-label": "Decorative gradient background",
@@ -84,8 +84,8 @@ function Ne() {
84
84
  }
85
85
  ) });
86
86
  }
87
- function Se() {
88
- const e = D(), i = [
87
+ function Ee() {
88
+ const e = V(), i = [
89
89
  {
90
90
  // (CSS #6) blue → top-right. x-radius widened so the lobe reaches further
91
91
  // left; y-radius kept short so it stays up top and doesn't bleed into the
@@ -161,7 +161,7 @@ function Se() {
161
161
  role: "presentation",
162
162
  children: [
163
163
  i.map((r) => /* @__PURE__ */ t(
164
- we,
164
+ ve,
165
165
  {
166
166
  layer: r,
167
167
  rect: { x: 0, y: 0, width: 400, height: 800 }
@@ -227,8 +227,8 @@ function Se() {
227
227
  }
228
228
  ) });
229
229
  }
230
- function Ee() {
231
- const e = D(), i = [
230
+ function be() {
231
+ const e = V(), i = [
232
232
  {
233
233
  id: `${e}-g6`,
234
234
  // (CSS #6) blue, top-right
@@ -347,8 +347,8 @@ function Ee() {
347
347
  }
348
348
  ) });
349
349
  }
350
- const be = Z + 16;
351
- function Ce({
350
+ const Ce = Z + 16;
351
+ function ke({
352
352
  children: e,
353
353
  className: i,
354
354
  contentClassName: r,
@@ -376,7 +376,7 @@ function Ce({
376
376
  ),
377
377
  style: o,
378
378
  children: [
379
- /* @__PURE__ */ t(Ee, {}),
379
+ /* @__PURE__ */ t(be, {}),
380
380
  /* @__PURE__ */ d(
381
381
  "div",
382
382
  {
@@ -390,8 +390,8 @@ function Ce({
390
390
  ),
391
391
  style: { clipPath: "inset(0 round 32px)" },
392
392
  children: [
393
- /* @__PURE__ */ t(Ne, {}),
394
393
  /* @__PURE__ */ t(Se, {}),
394
+ /* @__PURE__ */ t(Ee, {}),
395
395
  /* @__PURE__ */ d("div", { className: "zd:relative zd:z-10 zd:flex zd:flex-1 zd:flex-col zd:min-h-0", children: [
396
396
  c,
397
397
  /* @__PURE__ */ t(
@@ -399,7 +399,7 @@ function Ce({
399
399
  {
400
400
  className: "zd:flex zd:flex-1 zd:flex-col zd:min-h-0 zd:overflow-y-auto zd:overflow-x-hidden",
401
401
  style: {
402
- paddingTop: `calc(${be / 4} * var(--zd-spacing))`
402
+ paddingTop: `calc(${Ce / 4} * var(--zd-spacing))`
403
403
  },
404
404
  children: e
405
405
  }
@@ -412,11 +412,11 @@ function Ce({
412
412
  }
413
413
  );
414
414
  }
415
- const ke = "" + new URL("error.webp", import.meta.url).href, Ae = "" + new URL("loading.webp", import.meta.url).href, Oe = "" + new URL("send.webp", import.meta.url).href, Te = "" + new URL("success.webp", import.meta.url).href, Be = {
416
- error: ke,
417
- loading: Ae,
418
- send: Oe,
419
- success: Te
415
+ const Ae = "" + new URL("error.webp", import.meta.url).href, Oe = "" + new URL("loading.webp", import.meta.url).href, Te = "" + new URL("send.webp", import.meta.url).href, Be = "" + new URL("success.webp", import.meta.url).href, Ie = {
416
+ error: Ae,
417
+ loading: Oe,
418
+ send: Te,
419
+ success: Be
420
420
  };
421
421
  function I({
422
422
  imageName: e,
@@ -432,7 +432,7 @@ function I({
432
432
  /* @__PURE__ */ t(
433
433
  "img",
434
434
  {
435
- src: Be[e],
435
+ src: Ie[e],
436
436
  alt: e,
437
437
  className: "zd:w-[118px] zd:h-[118px] zd:bg-transparent"
438
438
  }
@@ -445,14 +445,14 @@ function I({
445
445
  }
446
446
  );
447
447
  }
448
- function ee() {
449
- const i = le().connectors.find((r) => r.id === "zerodev-wallet");
448
+ function Q() {
449
+ const i = ce().connectors.find((r) => r.id === "zerodev-wallet");
450
450
  if (!i || !("getKitStore" in i))
451
451
  throw new Error("useKitStore must be used with the zeroDevWallet connector");
452
452
  return i.getKitStore();
453
453
  }
454
454
  function F() {
455
- const e = ee(), i = O(e, (l) => l.auth.step), r = O(e, (l) => l.auth.stepHistory), n = O(e, (l) => l.auth.email), o = O(e, (l) => l.auth.otpId), c = O(
455
+ const e = Q(), i = O(e, (l) => l.auth.step), r = O(e, (l) => l.auth.stepHistory), n = O(e, (l) => l.auth.email), o = O(e, (l) => l.auth.otpId), c = O(
456
456
  e,
457
457
  (l) => l.auth.otpEncryptionTargetBundle
458
458
  ), s = O(e, (l) => l.auth.enabledMethods), u = O(e, (l) => l.auth.config);
@@ -484,13 +484,21 @@ function L({
484
484
  ),
485
485
  children: [
486
486
  /* @__PURE__ */ t(h, { children: "Powered by" }),
487
- /* @__PURE__ */ t(X, { name: "zerodevLogo", className: "zd:h-4.5 zd:w-auto", style: i })
487
+ /* @__PURE__ */ t(
488
+ se,
489
+ {
490
+ variant: "lockup",
491
+ tone: "black",
492
+ className: "zd:h-4.5 zd:w-auto",
493
+ style: i
494
+ }
495
+ )
488
496
  ]
489
497
  }
490
498
  );
491
499
  }
492
- function Ie() {
493
- const { email: e, setOtpSession: i } = F(), { mutateAsync: r, isPending: n } = J(), [o, c] = w(60), s = o <= 0 && !n;
500
+ function Fe() {
501
+ const { email: e, setOtpSession: i } = F(), { mutateAsync: r, isPending: n } = Y(), [o, c] = w(60), s = o <= 0 && !n;
494
502
  return P(() => {
495
503
  if (o <= 0) return;
496
504
  const l = setInterval(() => {
@@ -544,7 +552,7 @@ function Ie() {
544
552
  /* @__PURE__ */ t(L, { className: "zd:self-center zd:pt-4 zd:pb-6" })
545
553
  ] });
546
554
  }
547
- function Fe() {
555
+ function Pe() {
548
556
  return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).has("code");
549
557
  }
550
558
  function $() {
@@ -552,7 +560,7 @@ function $() {
552
560
  const e = new URL(window.location.href);
553
561
  e.searchParams.has("code") && (e.searchParams.delete("code"), window.history.replaceState(null, "", e.toString()));
554
562
  }
555
- function Pe({
563
+ function Re({
556
564
  title: e = "Oops, something went wrong",
557
565
  message: i = "We couldn't complete the sign-in process. This could be due to timeout, an expired link, or a cancelled request.",
558
566
  showRetry: r = !1,
@@ -580,11 +588,11 @@ function Pe({
580
588
  /* @__PURE__ */ t(L, { className: "zd:self-center zd:pt-4 zd:pb-6" })
581
589
  ] });
582
590
  }
583
- const Re = 4, Le = 8, $e = 6;
584
- function Ue(e) {
585
- return Math.max(Re, Math.min(Le, e));
591
+ const Le = 4, $e = 8, Ue = 6;
592
+ function Me(e) {
593
+ return Math.max(Le, Math.min($e, e));
586
594
  }
587
- function Me({ char: e, isFocused: i }) {
595
+ function je({ char: e, isFocused: i }) {
588
596
  return /* @__PURE__ */ t(
589
597
  ae,
590
598
  {
@@ -598,16 +606,16 @@ function Me({ char: e, isFocused: i }) {
598
606
  }
599
607
  );
600
608
  }
601
- function je({
609
+ function _e({
602
610
  onChange: e,
603
611
  onComplete: i,
604
612
  disabled: r = !1,
605
613
  error: n = !1,
606
614
  autoFocus: o = !1,
607
- length: c = $e,
615
+ length: c = Ue,
608
616
  "data-testid": s
609
617
  }) {
610
- const u = Ue(c), l = ie(
618
+ const u = Me(c), l = re(
611
619
  () => Array.from({ length: u }, (f, g) => ({
612
620
  id: `char-${g}`,
613
621
  index: g
@@ -655,7 +663,7 @@ function je({
655
663
  }
656
664
  ),
657
665
  l.map((f) => /* @__PURE__ */ t(
658
- Me,
666
+ je,
659
667
  {
660
668
  char: p[f.index] ?? "",
661
669
  isFocused: !n && m && f.index === p.length
@@ -666,7 +674,7 @@ function je({
666
674
  }
667
675
  );
668
676
  }
669
- function _e() {
677
+ function He() {
670
678
  const {
671
679
  email: e,
672
680
  otpId: i,
@@ -675,7 +683,7 @@ function _e() {
675
683
  clearOtpSession: o,
676
684
  goToStep: c,
677
685
  config: s
678
- } = F(), { mutateAsync: u, isPending: l } = Q(), { mutateAsync: p, isPending: x } = ue(), [m, N] = w(""), [k, S] = w(!1), [f, g] = w(60);
686
+ } = F(), { mutateAsync: u, isPending: l } = J(), { mutateAsync: p, isPending: x } = pe(), [m, N] = w(""), [k, S] = w(!1), [f, g] = w(60);
679
687
  P(() => {
680
688
  if (f <= 0) return;
681
689
  const v = setInterval(() => {
@@ -722,7 +730,7 @@ function _e() {
722
730
  ] })
723
731
  ] }),
724
732
  /* @__PURE__ */ t(
725
- je,
733
+ _e,
726
734
  {
727
735
  onComplete: y,
728
736
  onChange: () => S(!1),
@@ -757,7 +765,7 @@ function _e() {
757
765
  /* @__PURE__ */ t(L, { className: "zd:self-center zd:pt-4 zd:pb-6" })
758
766
  ] });
759
767
  }
760
- function He({
768
+ function Ge({
761
769
  termsAndConditionsUrl: e,
762
770
  privacyPolicyUrl: i,
763
771
  agreedToTerms: r,
@@ -812,18 +820,18 @@ function He({
812
820
  /* @__PURE__ */ t(L, {})
813
821
  ] });
814
822
  }
815
- const Ge = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
823
+ const We = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
816
824
  function M(e) {
817
- return Ge.test(e.trim());
825
+ return We.test(e.trim());
818
826
  }
819
- const We = "" + new URL("blob.webm", import.meta.url).href;
820
- function qe({ className: e }) {
827
+ const qe = "" + new URL("blob.webm", import.meta.url).href;
828
+ function De({ className: e }) {
821
829
  return /* @__PURE__ */ t(
822
830
  "video",
823
831
  {
824
832
  className: e,
825
833
  style: { aspectRatio: "1 / 1" },
826
- src: We,
834
+ src: qe,
827
835
  autoPlay: !0,
828
836
  loop: !0,
829
837
  muted: !0,
@@ -837,7 +845,7 @@ function H(e) {
837
845
  return e instanceof Error ? e.name === "AbortError" || e.name === "NotAllowedError" ? !0 : e.message.toLowerCase().includes("oauth popup was closed") : !1;
838
846
  }
839
847
  function Ve() {
840
- const { goToStep: e, setEmail: i, setOtpSession: r, config: n, enabledMethods: o } = F(), [c, s] = w(!1), [u, l] = w(!1), [p, x] = w(""), m = (n == null ? void 0 : n.emailAuthMethod) === "otp", { mutateAsync: N, isPending: k } = Q(), { mutateAsync: S, isPending: f } = J(), g = k || f, [T, y] = w(null), { mutateAsync: j, isPending: U } = pe({
848
+ const { goToStep: e, setEmail: i, setOtpSession: r, config: n, enabledMethods: o } = F(), [c, s] = w(!1), [u, l] = w(!1), [p, x] = w(""), m = (n == null ? void 0 : n.emailAuthMethod) === "otp", { mutateAsync: N, isPending: k } = J(), { mutateAsync: S, isPending: f } = Y(), g = k || f, [T, y] = w(null), { mutateAsync: j, isPending: U } = fe({
841
849
  mutation: {
842
850
  onSuccess: async () => {
843
851
  var a;
@@ -848,7 +856,7 @@ function Ve() {
848
856
  (z = n == null ? void 0 : n.onError) == null || z.call(n, a);
849
857
  }
850
858
  }
851
- }), { mutate: v, isPending: A } = fe({
859
+ }), { mutate: v, isPending: A } = he({
852
860
  mutation: {
853
861
  onSuccess: () => {
854
862
  var a;
@@ -859,7 +867,7 @@ function Ve() {
859
867
  H(a) || y(a instanceof Error ? a.message : String(a)), (z = n == null ? void 0 : n.onError) == null || z.call(n, a);
860
868
  }
861
869
  }
862
- }), { mutate: _, isPending: te } = he({
870
+ }), { mutate: _, isPending: ee } = ze({
863
871
  mutation: {
864
872
  onSuccess: () => {
865
873
  var a;
@@ -870,7 +878,7 @@ function Ve() {
870
878
  H(a) || y(a instanceof Error ? a.message : String(a)), (z = n == null ? void 0 : n.onError) == null || z.call(n, a);
871
879
  }
872
880
  }
873
- }), E = U || g || A || te, B = !!(n != null && n.termsAndConditionsUrl || n != null && n.privacyPolicyUrl) && !c, ne = () => {
881
+ }), E = U || g || A || ee, B = !!(n != null && n.termsAndConditionsUrl || n != null && n.privacyPolicyUrl) && !c, te = () => {
874
882
  if (!E) {
875
883
  if (B) {
876
884
  l(!0);
@@ -878,7 +886,7 @@ function Ve() {
878
886
  }
879
887
  y(null), v();
880
888
  }
881
- }, oe = () => {
889
+ }, ne = () => {
882
890
  if (!E) {
883
891
  if (B) {
884
892
  l(!0);
@@ -886,7 +894,7 @@ function Ve() {
886
894
  }
887
895
  y(null), _();
888
896
  }
889
- }, re = async () => {
897
+ }, oe = async () => {
890
898
  if (B) {
891
899
  l(!0);
892
900
  return;
@@ -949,7 +957,7 @@ function Ve() {
949
957
  ] }) }) : /* @__PURE__ */ d("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:justify-between zd:pb-4 zd:overflow-y-auto zd:overflow-x-hidden", children: [
950
958
  /* @__PURE__ */ d("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:justify-center", children: [
951
959
  /* @__PURE__ */ d("div", { className: "zd:px-4 zd:flex zd:flex-col zd:items-center", children: [
952
- /* @__PURE__ */ t("div", { className: "zd:w-full zd:px-16 zd:py-4", children: /* @__PURE__ */ t(qe, { className: "zd:w-full zd:pointer-events-none zd:select-none" }) }),
960
+ /* @__PURE__ */ t("div", { className: "zd:w-full zd:px-16 zd:py-4", children: /* @__PURE__ */ t(De, { className: "zd:w-full zd:pointer-events-none zd:select-none" }) }),
953
961
  /* @__PURE__ */ t(h, { className: "zd:text-h2 zd:text-center", children: "Continue to your wallet" }),
954
962
  /* @__PURE__ */ t(h, { className: "zd:mt-2 zd:text-center zd:text-greyScale/50", children: "Choose a sign-in method to proceed" })
955
963
  ] }),
@@ -964,7 +972,7 @@ function Ve() {
964
972
  iconName: "key",
965
973
  trailIcon: !0,
966
974
  disabled: E,
967
- onClick: ne
975
+ onClick: te
968
976
  }
969
977
  ),
970
978
  /* @__PURE__ */ t(
@@ -975,7 +983,7 @@ function Ve() {
975
983
  iconName: "key",
976
984
  trailIcon: !0,
977
985
  disabled: E,
978
- onClick: oe
986
+ onClick: ne
979
987
  }
980
988
  )
981
989
  ] }),
@@ -987,14 +995,14 @@ function Ve() {
987
995
  ] }),
988
996
  /* @__PURE__ */ d("div", { className: "zd:px-4 zd:flex zd:flex-col zd:gap-2", children: [
989
997
  o.includes("google") && /* @__PURE__ */ t(
990
- Y,
998
+ X,
991
999
  {
992
1000
  iconName: "google",
993
1001
  title: "Google",
994
1002
  chevron: !0,
995
1003
  className: "zd:rounded-3xl",
996
1004
  disabled: E,
997
- onClick: re
1005
+ onClick: oe
998
1006
  }
999
1007
  ),
1000
1008
  o.includes("email") && /* @__PURE__ */ t(
@@ -1020,7 +1028,7 @@ function Ve() {
1020
1028
  disabled: !M(p) || B,
1021
1029
  className: `zd:w-13 zd:h-13 zd:rounded-2xl zd:flex zd:items-center zd:justify-center zd:transition-colors ${M(p) && !B ? "zd:cursor-pointer" : "zd:cursor-not-allowed zd:opacity-50"}`,
1022
1030
  onClick: () => W(),
1023
- children: /* @__PURE__ */ t(X, { name: "chevronRight", className: "zd:text-greyScale" })
1031
+ children: /* @__PURE__ */ t(le, { name: "chevronRight", className: "zd:text-greyScale" })
1024
1032
  }
1025
1033
  )
1026
1034
  }
@@ -1029,7 +1037,7 @@ function Ve() {
1029
1037
  ] })
1030
1038
  ] }),
1031
1039
  /* @__PURE__ */ t("div", { className: "zd:px-4", children: /* @__PURE__ */ t(
1032
- He,
1040
+ Ge,
1033
1041
  {
1034
1042
  termsAndConditionsUrl: n == null ? void 0 : n.termsAndConditionsUrl,
1035
1043
  privacyPolicyUrl: n == null ? void 0 : n.privacyPolicyUrl,
@@ -1042,17 +1050,17 @@ function Ve() {
1042
1050
  ) })
1043
1051
  ] });
1044
1052
  }
1045
- function De() {
1053
+ function Ke() {
1046
1054
  return typeof window > "u" ? null : new URLSearchParams(window.location.search).get("code");
1047
1055
  }
1048
- function Ke() {
1056
+ function Xe() {
1049
1057
  const {
1050
1058
  otpId: e,
1051
1059
  otpEncryptionTargetBundle: i,
1052
1060
  goToStep: r,
1053
1061
  clearOtpSession: n,
1054
1062
  config: o
1055
- } = F(), [c] = w(De), [s, u] = w(null), l = K(!1), { mutate: p, isPending: x } = ze({
1063
+ } = F(), [c] = w(Ke), [s, u] = w(null), l = K(!1), { mutate: p, isPending: x } = me({
1056
1064
  mutation: {
1057
1065
  onSuccess: async () => {
1058
1066
  var m;
@@ -1109,8 +1117,8 @@ function Ke() {
1109
1117
  /* @__PURE__ */ t(L, { className: "zd:self-center zd:pt-4 zd:pb-6" })
1110
1118
  ] });
1111
1119
  }
1112
- function Xe() {
1113
- const { goToStep: e } = F(), { connect: i, connectors: r, isPending: n } = ce(), o = r.filter((s) => s.id !== "zerodev-wallet"), c = (s) => {
1120
+ function Ye() {
1121
+ const { goToStep: e } = F(), { connect: i, connectors: r, isPending: n } = ue(), o = r.filter((s) => s.id !== "zerodev-wallet"), c = (s) => {
1114
1122
  i(
1115
1123
  { connector: s },
1116
1124
  {
@@ -1124,7 +1132,7 @@ function Xe() {
1124
1132
  /* @__PURE__ */ d("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center", children: [
1125
1133
  /* @__PURE__ */ t(h, { className: "zd:text-h2 zd:text-center", children: "Select your wallet" }),
1126
1134
  /* @__PURE__ */ t("div", { className: "zd:flex zd:flex-col zd:gap-2", children: o.length === 0 ? /* @__PURE__ */ t(h, { className: "zd:text-center", children: "No wallets detected. Install a browser wallet extension to continue." }) : o.map((s) => /* @__PURE__ */ t(
1127
- Y,
1135
+ X,
1128
1136
  {
1129
1137
  title: s.name,
1130
1138
  iconName: "walletOutline",
@@ -1139,57 +1147,57 @@ function Xe() {
1139
1147
  /* @__PURE__ */ t(L, { className: "zd:self-center zd:pt-4 zd:pb-6" })
1140
1148
  ] });
1141
1149
  }
1142
- const Ye = {
1150
+ const Je = {
1143
1151
  "wallet-selection": "Choose your wallet"
1144
1152
  };
1145
- function Je() {
1153
+ function Ze() {
1146
1154
  return /* @__PURE__ */ t("div", { className: "zd:flex zd:flex-1 zd:items-center zd:justify-center", children: /* @__PURE__ */ t(I, { imageName: "loading", title: "Authenticating...", children: "Please wait while we complete the OAuth authentication." }) });
1147
1155
  }
1148
1156
  function Qe() {
1149
1157
  return /* @__PURE__ */ t("div", { className: "zd:flex zd:flex-1 zd:items-center zd:justify-center", children: /* @__PURE__ */ t(I, { imageName: "loading", title: "Passkey authentication", children: "Please authenticate with your passkey." }) });
1150
1158
  }
1151
- function Ze(e) {
1159
+ function et(e) {
1152
1160
  switch (e) {
1153
1161
  case "sign-up":
1154
1162
  return /* @__PURE__ */ t(Ve, {});
1155
1163
  case "email-verification":
1156
- return /* @__PURE__ */ t(Ie, {});
1164
+ return /* @__PURE__ */ t(Fe, {});
1157
1165
  case "otp-input":
1158
- return /* @__PURE__ */ t(_e, {});
1166
+ return /* @__PURE__ */ t(He, {});
1159
1167
  case "verifying-otp":
1160
- return /* @__PURE__ */ t(Ke, {});
1168
+ return /* @__PURE__ */ t(Xe, {});
1161
1169
  case "oauth-in-progress":
1162
- return /* @__PURE__ */ t(Je, {});
1170
+ return /* @__PURE__ */ t(Ze, {});
1163
1171
  case "passkey-prompt":
1164
1172
  return /* @__PURE__ */ t(Qe, {});
1165
1173
  case "wallet-selection":
1166
- return /* @__PURE__ */ t(Xe, {});
1174
+ return /* @__PURE__ */ t(Ye, {});
1167
1175
  case "error":
1168
- return /* @__PURE__ */ t(Pe, {});
1176
+ return /* @__PURE__ */ t(Re, {});
1169
1177
  default:
1170
1178
  return null;
1171
1179
  }
1172
1180
  }
1173
- function zt({
1181
+ function mt({
1174
1182
  onClose: e,
1175
1183
  size: i
1176
1184
  } = {}) {
1177
- const { step: r, goToStep: n, goBack: o, reset: c } = F(), s = O(ee(), (x) => x.logo);
1185
+ const { step: r, goToStep: n, goBack: o, reset: c } = F(), s = O(Q(), (x) => x.logo);
1178
1186
  P(() => {
1179
- r === null && Fe() && n("verifying-otp");
1187
+ r === null && Pe() && n("verifying-otp");
1180
1188
  }, [r, n]);
1181
- const u = Ze(r);
1189
+ const u = et(r);
1182
1190
  if (!u) return null;
1183
1191
  const l = () => {
1184
1192
  $(), c(), e == null || e();
1185
- }, p = r ? Ye[r] : void 0;
1193
+ }, p = r ? Je[r] : void 0;
1186
1194
  return /* @__PURE__ */ t(
1187
- Ce,
1195
+ ke,
1188
1196
  {
1189
1197
  ...i && { size: i },
1190
1198
  contentClassName: r === "sign-up" ? "zd:px-0" : void 0,
1191
1199
  topNav: /* @__PURE__ */ t(
1192
- xe,
1200
+ we,
1193
1201
  {
1194
1202
  ...o !== null && { onBack: o },
1195
1203
  onClose: l,
@@ -1205,7 +1213,7 @@ function zt({
1205
1213
  );
1206
1214
  }
1207
1215
  const G = "zerodev:auth:otpSession";
1208
- function et() {
1216
+ function tt() {
1209
1217
  if (typeof window > "u") return null;
1210
1218
  try {
1211
1219
  const e = window.localStorage.getItem(G);
@@ -1216,7 +1224,7 @@ function et() {
1216
1224
  return null;
1217
1225
  }
1218
1226
  }
1219
- function tt(e) {
1227
+ function nt(e) {
1220
1228
  if (!(typeof window > "u"))
1221
1229
  try {
1222
1230
  window.localStorage.setItem(
@@ -1226,14 +1234,14 @@ function tt(e) {
1226
1234
  } catch {
1227
1235
  }
1228
1236
  }
1229
- function V() {
1237
+ function D() {
1230
1238
  if (!(typeof window > "u"))
1231
1239
  try {
1232
1240
  window.localStorage.removeItem(G);
1233
1241
  } catch {
1234
1242
  }
1235
1243
  }
1236
- const nt = (e, i, r) => ({
1244
+ const ot = (e, i, r) => ({
1237
1245
  auth: {
1238
1246
  // Initial state
1239
1247
  step: null,
@@ -1245,7 +1253,7 @@ const nt = (e, i, r) => ({
1245
1253
  config: null,
1246
1254
  // Actions
1247
1255
  initialize: (n) => {
1248
- const o = et();
1256
+ const o = tt();
1249
1257
  e((c) => ({
1250
1258
  auth: {
1251
1259
  ...c.auth,
@@ -1280,7 +1288,7 @@ const nt = (e, i, r) => ({
1280
1288
  }));
1281
1289
  },
1282
1290
  reset: () => {
1283
- V(), e((n) => ({
1291
+ D(), e((n) => ({
1284
1292
  auth: {
1285
1293
  ...n.auth,
1286
1294
  step: null,
@@ -1300,7 +1308,7 @@ const nt = (e, i, r) => ({
1300
1308
  }));
1301
1309
  },
1302
1310
  setOtpSession: ({ otpId: n, otpEncryptionTargetBundle: o }) => {
1303
- tt({ otpId: n, otpEncryptionTargetBundle: o }), e((c) => ({
1311
+ nt({ otpId: n, otpEncryptionTargetBundle: o }), e((c) => ({
1304
1312
  auth: {
1305
1313
  ...c.auth,
1306
1314
  otpId: n,
@@ -1309,7 +1317,7 @@ const nt = (e, i, r) => ({
1309
1317
  }));
1310
1318
  },
1311
1319
  clearOtpSession: () => {
1312
- V(), e((n) => ({
1320
+ D(), e((n) => ({
1313
1321
  auth: {
1314
1322
  ...n.auth,
1315
1323
  otpId: null,
@@ -1318,8 +1326,8 @@ const nt = (e, i, r) => ({
1318
1326
  }));
1319
1327
  }
1320
1328
  }
1321
- }), ot = (e = {}) => se()(
1322
- ye((i, r, n) => ({
1329
+ }), rt = (e = {}) => ie()(
1330
+ xe((i, r, n) => ({
1323
1331
  pendingRequests: [],
1324
1332
  userConfirmationListenerActive: !1,
1325
1333
  logo: e.logo ?? null,
@@ -1331,10 +1339,10 @@ const nt = (e, i, r) => ({
1331
1339
  })),
1332
1340
  clearPendingRequests: () => i({ pendingRequests: [] }),
1333
1341
  setUserConfirmationListenerActive: (o) => i({ userConfirmationListenerActive: o }),
1334
- ...nt(i, r)
1342
+ ...ot(i, r)
1335
1343
  }))
1336
1344
  );
1337
- function rt(e) {
1345
+ function it(e) {
1338
1346
  return new Promise((i, r) => {
1339
1347
  const n = e.subscribe(
1340
1348
  (o) => o.auth.step,
@@ -1344,9 +1352,9 @@ function rt(e) {
1344
1352
  );
1345
1353
  });
1346
1354
  }
1347
- function mt(e) {
1355
+ function gt(e) {
1348
1356
  var n, o;
1349
- const i = me(e), r = ot({ logo: (n = e.config) == null ? void 0 : n.logo });
1357
+ const i = ge(e), r = rt({ logo: (n = e.config) == null ? void 0 : n.logo });
1350
1358
  return (o = e.config) != null && o.auth && r.getState().auth.initialize(e.config.auth), (c) => {
1351
1359
  const s = i(c);
1352
1360
  return {
@@ -1356,11 +1364,11 @@ function mt(e) {
1356
1364
  try {
1357
1365
  return await s.connect(u);
1358
1366
  } catch (p) {
1359
- if (u != null && u.isReconnecting || !((l = e.config) != null && l.auth) || !(p instanceof ge))
1367
+ if (u != null && u.isReconnecting || !((l = e.config) != null && l.auth) || !(p instanceof ye))
1360
1368
  throw p;
1361
1369
  if (r.getState().auth.step !== null)
1362
1370
  throw new Error("Auth flow already in progress");
1363
- return r.getState().auth.goToStep("sign-up"), await rt(r), s.connect(u);
1371
+ return r.getState().auth.goToStep("sign-up"), await it(r), s.connect(u);
1364
1372
  }
1365
1373
  },
1366
1374
  async disconnect() {
@@ -1378,8 +1386,8 @@ function mt(e) {
1378
1386
  };
1379
1387
  }
1380
1388
  export {
1381
- zt as AuthFlow,
1389
+ mt as AuthFlow,
1382
1390
  F as useAuth,
1383
- mt as zeroDevWallet
1391
+ gt as zeroDevWallet
1384
1392
  };
1385
1393
  //# sourceMappingURL=index.mjs.map