@zerodev/wallet-react-ui 0.0.6 → 0.0.7
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/README.md +54 -10
- package/dist/_types/auth/authStoreSlice.d.ts +3 -4
- package/dist/_types/auth/authStoreSlice.d.ts.map +1 -1
- package/dist/_types/auth/hooks/useAuth.d.ts +0 -2
- package/dist/_types/auth/hooks/useAuth.d.ts.map +1 -1
- package/dist/_types/auth/index.d.ts +9 -1
- package/dist/_types/auth/index.d.ts.map +1 -1
- package/dist/_types/auth/pages/OtpInput.d.ts.map +1 -1
- package/dist/_types/auth/pages/SignUp/Email.d.ts +4 -0
- package/dist/_types/auth/pages/SignUp/Email.d.ts.map +1 -0
- package/dist/_types/auth/pages/SignUp/Google.d.ts +3 -0
- package/dist/_types/auth/pages/SignUp/Google.d.ts.map +1 -0
- package/dist/_types/auth/pages/SignUp/Passkey.d.ts +3 -0
- package/dist/_types/auth/pages/SignUp/Passkey.d.ts.map +1 -0
- package/dist/_types/auth/pages/SignUp/context.d.ts +25 -0
- package/dist/_types/auth/pages/SignUp/context.d.ts.map +1 -0
- package/dist/_types/auth/pages/SignUp/index.d.ts +31 -0
- package/dist/_types/auth/pages/SignUp/index.d.ts.map +1 -0
- package/dist/_types/auth/pages/Verifying.d.ts.map +1 -1
- package/dist/_types/auth/types.d.ts +0 -8
- package/dist/_types/auth/types.d.ts.map +1 -1
- package/dist/_types/auth/utils/isCancellationError.d.ts +2 -0
- package/dist/_types/auth/utils/isCancellationError.d.ts.map +1 -0
- package/dist/_types/connector.d.ts +3 -13
- package/dist/_types/connector.d.ts.map +1 -1
- package/dist/_types/index.d.ts +4 -3
- package/dist/_types/index.d.ts.map +1 -1
- package/dist/_types/store.d.ts +1 -6
- package/dist/_types/store.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +555 -562
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/auth/authStoreSlice.ts +7 -13
- package/src/auth/hooks/useAuth.ts +0 -5
- package/src/auth/index.tsx +19 -7
- package/src/auth/pages/OtpInput.tsx +1 -4
- package/src/auth/pages/SignUp/Email.tsx +86 -0
- package/src/auth/pages/SignUp/Google.tsx +43 -0
- package/src/auth/pages/SignUp/Passkey.tsx +56 -0
- package/src/auth/pages/SignUp/context.tsx +41 -0
- package/src/auth/pages/SignUp/index.tsx +138 -0
- package/src/auth/pages/Verifying.tsx +3 -10
- package/src/auth/types.ts +0 -9
- package/src/auth/utils/isCancellationError.ts +8 -0
- package/src/connector.ts +12 -28
- package/src/index.ts +3 -3
- package/src/store.ts +1 -8
- package/dist/_types/auth/pages/SignUp.d.ts +0 -2
- package/dist/_types/auth/pages/SignUp.d.ts.map +0 -1
- package/src/auth/pages/SignUp.tsx +0 -311
package/dist/index.mjs
CHANGED
|
@@ -1,83 +1,81 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Text as m, cn as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useStore as
|
|
5
|
-
import { useConfig as
|
|
6
|
-
import { useSendMagicLink as
|
|
7
|
-
import { subscribeWithSelector as
|
|
8
|
-
const
|
|
9
|
-
error:
|
|
10
|
-
loading:
|
|
11
|
-
send:
|
|
12
|
-
success:
|
|
1
|
+
import { jsxs as d, jsx as t, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { Text as m, cn as H, PoweredBy as T, Button as w, Wrapper as Q, Input as Z, Icon as ee, ListItem as _, ListItemChevron as te, ListItemIcon as q, Screen as ne, TopNav as re } from "@zerodev/react-ui";
|
|
3
|
+
import { useState as z, useEffect as k, useMemo as ie, useRef as D, createContext as se, useContext as oe } from "react";
|
|
4
|
+
import { useStore as C, create as ae } from "zustand";
|
|
5
|
+
import { useConfig as de, useConnect as ce } from "wagmi";
|
|
6
|
+
import { useSendMagicLink as W, useSendOTP as F, useVerifyOTP as le, useAuthenticateOAuth as ue, useRegisterPasskey as pe, useLoginPasskey as he, useVerifyMagicLink as me, zeroDevWallet as fe, NotAuthenticatedError as ge } from "@zerodev/wallet-react";
|
|
7
|
+
import { subscribeWithSelector as ze } from "zustand/middleware";
|
|
8
|
+
const ye = "" + new URL("error.webp", import.meta.url).href, xe = "" + new URL("loading.webp", import.meta.url).href, we = "" + new URL("send.webp", import.meta.url).href, Se = "" + new URL("success.webp", import.meta.url).href, Ne = {
|
|
9
|
+
error: ye,
|
|
10
|
+
loading: xe,
|
|
11
|
+
send: we,
|
|
12
|
+
success: Se
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function E({
|
|
15
15
|
imageName: e,
|
|
16
|
-
title:
|
|
17
|
-
children:
|
|
18
|
-
className:
|
|
16
|
+
title: r,
|
|
17
|
+
children: s,
|
|
18
|
+
className: i
|
|
19
19
|
}) {
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ d(
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
23
|
-
className:
|
|
23
|
+
className: H("zd:flex zd:flex-col zd:gap-8 zd:items-center", i),
|
|
24
24
|
children: [
|
|
25
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ t(
|
|
26
26
|
"img",
|
|
27
27
|
{
|
|
28
|
-
src:
|
|
28
|
+
src: Ne[e],
|
|
29
29
|
alt: e,
|
|
30
30
|
className: "zd:w-[118px] zd:h-[118px] zd:bg-transparent"
|
|
31
31
|
}
|
|
32
32
|
),
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ d("div", { className: "zd:flex zd:flex-col zd:gap-4 zd:items-center", children: [
|
|
34
|
+
/* @__PURE__ */ t(m, { className: "zd:text-h2 zd:text-center zd:whitespace-pre-wrap", children: r }),
|
|
35
|
+
/* @__PURE__ */ t(m, { className: "zd:text-center zd:whitespace-pre-wrap", children: s })
|
|
36
36
|
] })
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
41
|
+
function ve() {
|
|
42
|
+
const r = de().connectors.find((s) => s.id === "zerodev-wallet");
|
|
43
|
+
if (!r || !("getKitStore" in r))
|
|
44
44
|
throw new Error("useKitStore must be used with the zeroDevWallet connector");
|
|
45
|
-
return
|
|
45
|
+
return r.getKitStore();
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const e =
|
|
47
|
+
function S() {
|
|
48
|
+
const e = ve(), r = C(e, (o) => o.auth.step), s = C(e, (o) => o.auth.stepHistory), i = C(e, (o) => o.auth.email), n = C(e, (o) => o.auth.otpId), a = C(
|
|
49
49
|
e,
|
|
50
|
-
(
|
|
51
|
-
)
|
|
50
|
+
(o) => o.auth.otpEncryptionTargetBundle
|
|
51
|
+
);
|
|
52
52
|
return {
|
|
53
|
-
step:
|
|
54
|
-
email:
|
|
55
|
-
otpId:
|
|
56
|
-
otpEncryptionTargetBundle:
|
|
57
|
-
enabledMethods: i,
|
|
58
|
-
config: u,
|
|
53
|
+
step: r,
|
|
54
|
+
email: i,
|
|
55
|
+
otpId: n,
|
|
56
|
+
otpEncryptionTargetBundle: a,
|
|
59
57
|
goToStep: e.getState().auth.goToStep,
|
|
60
|
-
goBack:
|
|
58
|
+
goBack: s.length > 0 ? e.getState().auth.goBack : null,
|
|
61
59
|
reset: e.getState().auth.reset,
|
|
62
60
|
setEmail: e.getState().auth.setEmail,
|
|
63
61
|
setOtpSession: e.getState().auth.setOtpSession,
|
|
64
62
|
clearOtpSession: e.getState().auth.clearOtpSession
|
|
65
63
|
};
|
|
66
64
|
}
|
|
67
|
-
function
|
|
68
|
-
const { email: e, setOtpSession:
|
|
69
|
-
return
|
|
70
|
-
if (
|
|
65
|
+
function be() {
|
|
66
|
+
const { email: e, setOtpSession: r } = S(), { mutateAsync: s, isPending: i } = W(), [n, a] = z(60), o = n <= 0 && !i;
|
|
67
|
+
return k(() => {
|
|
68
|
+
if (n <= 0) return;
|
|
71
69
|
const l = setInterval(() => {
|
|
72
|
-
|
|
70
|
+
a((p) => Math.max(0, p - 1));
|
|
73
71
|
}, 1e3);
|
|
74
72
|
return () => {
|
|
75
73
|
clearInterval(l);
|
|
76
74
|
};
|
|
77
|
-
}, [
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
75
|
+
}, [n]), /* @__PURE__ */ d(N, { children: [
|
|
76
|
+
/* @__PURE__ */ d("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center", children: [
|
|
77
|
+
/* @__PURE__ */ d(
|
|
78
|
+
E,
|
|
81
79
|
{
|
|
82
80
|
imageName: "send",
|
|
83
81
|
title: `Check your email!
|
|
@@ -85,279 +83,277 @@ function Ee() {
|
|
|
85
83
|
children: [
|
|
86
84
|
"We've sent a magic link to",
|
|
87
85
|
" ",
|
|
88
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ t(m, { as: "span", className: "zd:text-solarOrange", children: e }),
|
|
89
87
|
`
|
|
90
88
|
`,
|
|
91
89
|
"Please open the email and click the link to log in."
|
|
92
90
|
]
|
|
93
91
|
}
|
|
94
92
|
),
|
|
95
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ t("div", { className: "zd:flex zd:flex-col zd:gap-1", children: /* @__PURE__ */ d(m, { className: "zd:text-center", children: [
|
|
96
94
|
"Did not get an email?",
|
|
97
95
|
" ",
|
|
98
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ t(
|
|
99
97
|
"button",
|
|
100
98
|
{
|
|
101
99
|
type: "button",
|
|
102
|
-
disabled: !
|
|
100
|
+
disabled: !o,
|
|
103
101
|
onClick: async () => {
|
|
104
|
-
if (!(!e || !
|
|
102
|
+
if (!(!e || !o))
|
|
105
103
|
try {
|
|
106
|
-
const { otpId: l, otpEncryptionTargetBundle:
|
|
104
|
+
const { otpId: l, otpEncryptionTargetBundle: p } = await s({
|
|
107
105
|
email: e
|
|
108
106
|
});
|
|
109
|
-
|
|
107
|
+
r({ otpId: l, otpEncryptionTargetBundle: p }), a(60);
|
|
110
108
|
} catch {
|
|
111
109
|
}
|
|
112
110
|
},
|
|
113
111
|
className: "zd:cursor-pointer zd:underline zd:disabled:opacity-50 zd:disabled:cursor-not-allowed",
|
|
114
|
-
children:
|
|
112
|
+
children: o ? "Resend" : `Resend in ${n} ${n === 1 ? "second" : "seconds"}`
|
|
115
113
|
}
|
|
116
114
|
)
|
|
117
115
|
] }) })
|
|
118
116
|
] }),
|
|
119
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ t(T, { className: "zd:self-center zd:pt-4 zd:pb-6" })
|
|
120
118
|
] });
|
|
121
119
|
}
|
|
122
|
-
function
|
|
120
|
+
function Ee() {
|
|
123
121
|
return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).has("code");
|
|
124
122
|
}
|
|
125
|
-
function
|
|
123
|
+
function A() {
|
|
126
124
|
if (typeof window > "u") return;
|
|
127
125
|
const e = new URL(window.location.href);
|
|
128
126
|
e.searchParams.has("code") && (e.searchParams.delete("code"), window.history.replaceState(null, "", e.toString()));
|
|
129
127
|
}
|
|
130
|
-
function
|
|
128
|
+
function ke({
|
|
131
129
|
title: e = "Oops, something went wrong",
|
|
132
|
-
message:
|
|
133
|
-
showRetry:
|
|
134
|
-
showChooseAnother:
|
|
130
|
+
message: r = "We couldn't complete the sign-in process. This could be due to timeout, an expired link, or a cancelled request.",
|
|
131
|
+
showRetry: s = !1,
|
|
132
|
+
showChooseAnother: i = !0
|
|
135
133
|
}) {
|
|
136
|
-
const { goToStep:
|
|
137
|
-
return /* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
134
|
+
const { goToStep: n, goBack: a, reset: o } = S();
|
|
135
|
+
return /* @__PURE__ */ d(N, { children: [
|
|
136
|
+
/* @__PURE__ */ d("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center", children: [
|
|
137
|
+
/* @__PURE__ */ t(E, { imageName: "error", title: e, children: r }),
|
|
138
|
+
/* @__PURE__ */ d("div", { className: "zd:flex zd:flex-col zd:gap-1", children: [
|
|
139
|
+
s && /* @__PURE__ */ t(w, { action: "primary", text: "Try again", onClick: a ?? (() => n("sign-up")) }),
|
|
140
|
+
i && /* @__PURE__ */ t(
|
|
141
|
+
w,
|
|
144
142
|
{
|
|
145
|
-
action:
|
|
143
|
+
action: s ? "secondary" : "primary",
|
|
146
144
|
onClick: () => {
|
|
147
|
-
|
|
145
|
+
A(), n("sign-up");
|
|
148
146
|
},
|
|
149
147
|
text: "Choose another sign-in method"
|
|
150
148
|
}
|
|
151
149
|
),
|
|
152
|
-
!
|
|
150
|
+
!s && !i && /* @__PURE__ */ t(w, { action: "primary", text: "Start over", onClick: o })
|
|
153
151
|
] })
|
|
154
152
|
] }),
|
|
155
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ t(T, { className: "zd:self-center zd:pt-4 zd:pb-6" })
|
|
156
154
|
] });
|
|
157
155
|
}
|
|
158
|
-
const
|
|
159
|
-
function
|
|
160
|
-
return Math.max(
|
|
156
|
+
const Te = 4, Ie = 8, Ce = 6;
|
|
157
|
+
function Ae(e) {
|
|
158
|
+
return Math.max(Te, Math.min(Ie, e));
|
|
161
159
|
}
|
|
162
|
-
function Pe({ char: e, isFocused:
|
|
163
|
-
return /* @__PURE__ */
|
|
164
|
-
|
|
160
|
+
function Pe({ char: e, isFocused: r }) {
|
|
161
|
+
return /* @__PURE__ */ t(
|
|
162
|
+
Q,
|
|
165
163
|
{
|
|
166
164
|
"data-testid": "code-input-box",
|
|
167
|
-
"data-active":
|
|
168
|
-
className:
|
|
165
|
+
"data-active": r || void 0,
|
|
166
|
+
className: H(
|
|
169
167
|
"zd:h-16 zd:w-14 zd:rounded-lg zd:flex zd:items-center zd:justify-center",
|
|
170
|
-
|
|
168
|
+
r && "zd:border-[1.5px] zd:border-greyScale"
|
|
171
169
|
),
|
|
172
|
-
children: /* @__PURE__ */
|
|
170
|
+
children: /* @__PURE__ */ t(m, { className: "zd:text-h2", children: e })
|
|
173
171
|
}
|
|
174
172
|
);
|
|
175
173
|
}
|
|
176
174
|
function Re({
|
|
177
175
|
onChange: e,
|
|
178
|
-
onComplete:
|
|
179
|
-
disabled:
|
|
180
|
-
error:
|
|
181
|
-
autoFocus:
|
|
182
|
-
length:
|
|
183
|
-
"data-testid":
|
|
176
|
+
onComplete: r,
|
|
177
|
+
disabled: s = !1,
|
|
178
|
+
error: i = !1,
|
|
179
|
+
autoFocus: n = !1,
|
|
180
|
+
length: a = Ce,
|
|
181
|
+
"data-testid": o
|
|
184
182
|
}) {
|
|
185
|
-
const
|
|
186
|
-
() => Array.from({ length:
|
|
187
|
-
id: `char-${
|
|
188
|
-
index:
|
|
183
|
+
const c = Ae(a), l = ie(
|
|
184
|
+
() => Array.from({ length: c }, (u, x) => ({
|
|
185
|
+
id: `char-${x}`,
|
|
186
|
+
index: x
|
|
189
187
|
})),
|
|
190
|
-
[
|
|
191
|
-
), [
|
|
192
|
-
|
|
193
|
-
var
|
|
194
|
-
|
|
195
|
-
}, [
|
|
196
|
-
|
|
197
|
-
}, [
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
x
|
|
201
|
-
var
|
|
202
|
-
|
|
188
|
+
[c]
|
|
189
|
+
), [p, h] = z(""), [v, b] = z(!1), f = D(null);
|
|
190
|
+
k(() => {
|
|
191
|
+
var u;
|
|
192
|
+
n && !s && ((u = f.current) == null || u.focus());
|
|
193
|
+
}, [n, s]), k(() => {
|
|
194
|
+
h((u) => u.slice(0, c));
|
|
195
|
+
}, [c]);
|
|
196
|
+
const y = (u) => {
|
|
197
|
+
const x = u.slice(0, c).toUpperCase();
|
|
198
|
+
h(x), e == null || e(x), x.length === c && setTimeout(() => {
|
|
199
|
+
var g;
|
|
200
|
+
r == null || r(x), (g = f.current) == null || g.blur();
|
|
203
201
|
}, 0);
|
|
204
202
|
};
|
|
205
|
-
return /* @__PURE__ */
|
|
203
|
+
return /* @__PURE__ */ d(
|
|
206
204
|
"button",
|
|
207
205
|
{
|
|
208
206
|
type: "button",
|
|
209
207
|
className: "zd:flex zd:flex-row zd:items-center zd:justify-between zd:gap-2 zd:w-full zd:cursor-text",
|
|
210
208
|
onClick: () => {
|
|
211
|
-
var
|
|
212
|
-
return (
|
|
209
|
+
var u;
|
|
210
|
+
return (u = f.current) == null ? void 0 : u.focus();
|
|
213
211
|
},
|
|
214
|
-
disabled:
|
|
215
|
-
"data-testid":
|
|
212
|
+
disabled: s,
|
|
213
|
+
"data-testid": o,
|
|
216
214
|
children: [
|
|
217
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ t(
|
|
218
216
|
"input",
|
|
219
217
|
{
|
|
220
|
-
ref:
|
|
221
|
-
value:
|
|
222
|
-
onChange: (
|
|
223
|
-
onFocus: () =>
|
|
224
|
-
onBlur: () =>
|
|
225
|
-
maxLength:
|
|
226
|
-
disabled:
|
|
218
|
+
ref: f,
|
|
219
|
+
value: p,
|
|
220
|
+
onChange: (u) => y(u.target.value),
|
|
221
|
+
onFocus: () => b(!0),
|
|
222
|
+
onBlur: () => b(!1),
|
|
223
|
+
maxLength: c,
|
|
224
|
+
disabled: s,
|
|
227
225
|
className: "zd:absolute zd:opacity-0 zd:pointer-events-none",
|
|
228
226
|
style: { position: "absolute", opacity: 0 },
|
|
229
227
|
"aria-label": "Verification code"
|
|
230
228
|
}
|
|
231
229
|
),
|
|
232
|
-
l.map((
|
|
230
|
+
l.map((u) => /* @__PURE__ */ t(
|
|
233
231
|
Pe,
|
|
234
232
|
{
|
|
235
|
-
char:
|
|
236
|
-
isFocused: !
|
|
233
|
+
char: p[u.index] ?? "",
|
|
234
|
+
isFocused: !i && v && u.index === p.length
|
|
237
235
|
},
|
|
238
|
-
|
|
236
|
+
u.id
|
|
239
237
|
))
|
|
240
238
|
]
|
|
241
239
|
}
|
|
242
240
|
);
|
|
243
241
|
}
|
|
244
|
-
function
|
|
242
|
+
function Le() {
|
|
245
243
|
const {
|
|
246
244
|
email: e,
|
|
247
|
-
otpId:
|
|
248
|
-
otpEncryptionTargetBundle:
|
|
249
|
-
setOtpSession:
|
|
250
|
-
clearOtpSession:
|
|
251
|
-
goToStep:
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
g((T) => Math.max(0, T - 1));
|
|
245
|
+
otpId: r,
|
|
246
|
+
otpEncryptionTargetBundle: s,
|
|
247
|
+
setOtpSession: i,
|
|
248
|
+
clearOtpSession: n,
|
|
249
|
+
goToStep: a
|
|
250
|
+
} = S(), { mutateAsync: o, isPending: c } = F(), { mutateAsync: l, isPending: p } = le(), [h, v] = z(""), [b, f] = z(!1), [y, u] = z(60);
|
|
251
|
+
k(() => {
|
|
252
|
+
if (y <= 0) return;
|
|
253
|
+
const I = setInterval(() => {
|
|
254
|
+
u((O) => Math.max(0, O - 1));
|
|
258
255
|
}, 1e3);
|
|
259
|
-
return () => clearInterval(
|
|
260
|
-
}, [
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
v(!1);
|
|
256
|
+
return () => clearInterval(I);
|
|
257
|
+
}, [y]);
|
|
258
|
+
const x = async () => {
|
|
259
|
+
if (!(!h.trim() || !r || !s)) {
|
|
260
|
+
f(!1);
|
|
265
261
|
try {
|
|
266
|
-
await
|
|
267
|
-
otpId:
|
|
268
|
-
code:
|
|
269
|
-
otpEncryptionTargetBundle:
|
|
270
|
-
}),
|
|
271
|
-
} catch
|
|
272
|
-
|
|
262
|
+
await l({
|
|
263
|
+
otpId: r,
|
|
264
|
+
code: h.trim(),
|
|
265
|
+
otpEncryptionTargetBundle: s
|
|
266
|
+
}), n(), a("authenticated");
|
|
267
|
+
} catch {
|
|
268
|
+
f(!0);
|
|
273
269
|
}
|
|
274
270
|
}
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
},
|
|
278
|
-
if (!(!e ||
|
|
271
|
+
}, g = (I) => {
|
|
272
|
+
v(I);
|
|
273
|
+
}, L = async () => {
|
|
274
|
+
if (!(!e || y > 0 || c))
|
|
279
275
|
try {
|
|
280
|
-
const { otpId:
|
|
281
|
-
|
|
282
|
-
otpId:
|
|
283
|
-
otpEncryptionTargetBundle:
|
|
284
|
-
}),
|
|
276
|
+
const { otpId: I, otpEncryptionTargetBundle: O } = await o({ email: e });
|
|
277
|
+
i({
|
|
278
|
+
otpId: I,
|
|
279
|
+
otpEncryptionTargetBundle: O
|
|
280
|
+
}), u(60), f(!1);
|
|
285
281
|
} catch {
|
|
286
|
-
|
|
282
|
+
f(!0);
|
|
287
283
|
}
|
|
288
|
-
},
|
|
289
|
-
return /* @__PURE__ */
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
/* @__PURE__ */
|
|
284
|
+
}, P = y <= 0 && !c;
|
|
285
|
+
return /* @__PURE__ */ d(N, { children: [
|
|
286
|
+
/* @__PURE__ */ d("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center zd:items-center", children: [
|
|
287
|
+
/* @__PURE__ */ d("div", { className: "zd:flex zd:flex-col zd:gap-4", children: [
|
|
288
|
+
/* @__PURE__ */ t(m, { className: "zd:text-h2 zd:text-center", children: "Enter verification code" }),
|
|
289
|
+
/* @__PURE__ */ d(m, { className: "zd:text-center", children: [
|
|
294
290
|
"Enter the code from the email we sent to",
|
|
295
291
|
" ",
|
|
296
|
-
/* @__PURE__ */
|
|
292
|
+
/* @__PURE__ */ t(m, { className: "zd:text-solarOrange", children: e })
|
|
297
293
|
] })
|
|
298
294
|
] }),
|
|
299
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ t(
|
|
300
296
|
Re,
|
|
301
297
|
{
|
|
302
|
-
onComplete:
|
|
303
|
-
onChange: () =>
|
|
304
|
-
disabled:
|
|
305
|
-
error:
|
|
298
|
+
onComplete: g,
|
|
299
|
+
onChange: () => f(!1),
|
|
300
|
+
disabled: p,
|
|
301
|
+
error: b,
|
|
306
302
|
autoFocus: !0
|
|
307
303
|
}
|
|
308
304
|
),
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
|
|
305
|
+
/* @__PURE__ */ t(
|
|
306
|
+
w,
|
|
311
307
|
{
|
|
312
308
|
text: "Confirm code",
|
|
313
|
-
onClick:
|
|
314
|
-
disabled: !
|
|
309
|
+
onClick: x,
|
|
310
|
+
disabled: !h.trim() || p
|
|
315
311
|
}
|
|
316
312
|
),
|
|
317
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ t("div", { className: "zd:flex zd:flex-col zd:gap-1", children: /* @__PURE__ */ d(m, { className: "zd:text-center", children: [
|
|
318
314
|
"Did not get an email?",
|
|
319
315
|
" ",
|
|
320
|
-
/* @__PURE__ */
|
|
316
|
+
/* @__PURE__ */ t(
|
|
321
317
|
"button",
|
|
322
318
|
{
|
|
323
319
|
type: "button",
|
|
324
|
-
disabled: !
|
|
325
|
-
onClick:
|
|
320
|
+
disabled: !P,
|
|
321
|
+
onClick: L,
|
|
326
322
|
className: "zd:cursor-pointer zd:underline zd:disabled:opacity-50 zd:disabled:cursor-not-allowed",
|
|
327
|
-
children:
|
|
323
|
+
children: P ? "Resend" : `Resend in ${y} ${y === 1 ? "second" : "seconds"}`
|
|
328
324
|
}
|
|
329
325
|
)
|
|
330
326
|
] }) })
|
|
331
327
|
] }),
|
|
332
|
-
/* @__PURE__ */
|
|
328
|
+
/* @__PURE__ */ t(T, { className: "zd:self-center zd:pt-4 zd:pb-6" })
|
|
333
329
|
] });
|
|
334
330
|
}
|
|
335
|
-
function
|
|
331
|
+
function Oe({
|
|
336
332
|
termsAndConditionsUrl: e,
|
|
337
|
-
privacyPolicyUrl:
|
|
338
|
-
agreedToTerms:
|
|
339
|
-
setAgreedToTerms:
|
|
340
|
-
highlight:
|
|
333
|
+
privacyPolicyUrl: r,
|
|
334
|
+
agreedToTerms: s,
|
|
335
|
+
setAgreedToTerms: i,
|
|
336
|
+
highlight: n = !1
|
|
341
337
|
}) {
|
|
342
|
-
return /* @__PURE__ */
|
|
343
|
-
!!(e ||
|
|
338
|
+
return /* @__PURE__ */ d("div", { className: "zd:flex zd:flex-col zd:items-center zd:gap-5", children: [
|
|
339
|
+
!!(e || r) && /* @__PURE__ */ d(
|
|
344
340
|
"div",
|
|
345
341
|
{
|
|
346
|
-
className: `zd:flex zd:flex-row zd:items-center zd:gap-2 zd:rounded-md zd:p-2 zd:transition-colors ${
|
|
342
|
+
className: `zd:flex zd:flex-row zd:items-center zd:gap-2 zd:rounded-md zd:p-2 zd:transition-colors ${n ? "zd:border zd:border-negative" : "zd:border zd:border-transparent"}`,
|
|
347
343
|
children: [
|
|
348
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ t(
|
|
349
345
|
"input",
|
|
350
346
|
{
|
|
351
347
|
type: "checkbox",
|
|
352
|
-
checked:
|
|
353
|
-
onChange: (
|
|
348
|
+
checked: s,
|
|
349
|
+
onChange: (o) => i(o.target.checked),
|
|
354
350
|
className: "zd:cursor-pointer zd:[color-scheme:light]"
|
|
355
351
|
}
|
|
356
352
|
),
|
|
357
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ d(m, { className: "zd:flex-1", children: [
|
|
358
354
|
"I agree to the",
|
|
359
355
|
" ",
|
|
360
|
-
e && /* @__PURE__ */
|
|
356
|
+
e && /* @__PURE__ */ t(
|
|
361
357
|
m,
|
|
362
358
|
{
|
|
363
359
|
as: "a",
|
|
@@ -368,12 +364,12 @@ function Be({
|
|
|
368
364
|
children: "Terms & Conditions"
|
|
369
365
|
}
|
|
370
366
|
),
|
|
371
|
-
e &&
|
|
372
|
-
|
|
367
|
+
e && r && " and ",
|
|
368
|
+
r && /* @__PURE__ */ t(
|
|
373
369
|
m,
|
|
374
370
|
{
|
|
375
371
|
as: "a",
|
|
376
|
-
href:
|
|
372
|
+
href: r,
|
|
377
373
|
target: "_blank",
|
|
378
374
|
rel: "noopener noreferrer",
|
|
379
375
|
className: "zd:underline",
|
|
@@ -384,21 +380,17 @@ function Be({
|
|
|
384
380
|
]
|
|
385
381
|
}
|
|
386
382
|
),
|
|
387
|
-
/* @__PURE__ */
|
|
383
|
+
/* @__PURE__ */ t(T, {})
|
|
388
384
|
] });
|
|
389
385
|
}
|
|
390
|
-
const
|
|
391
|
-
function
|
|
392
|
-
return
|
|
393
|
-
}
|
|
394
|
-
const Ue = "" + new URL("blob.webm", import.meta.url).href;
|
|
395
|
-
function je({ className: e }) {
|
|
396
|
-
return /* @__PURE__ */ n(
|
|
386
|
+
const Be = "" + new URL("blob.webm", import.meta.url).href;
|
|
387
|
+
function Ue({ className: e }) {
|
|
388
|
+
return /* @__PURE__ */ t(
|
|
397
389
|
"video",
|
|
398
390
|
{
|
|
399
391
|
className: e,
|
|
400
392
|
style: { aspectRatio: "1 / 1" },
|
|
401
|
-
src:
|
|
393
|
+
src: Be,
|
|
402
394
|
autoPlay: !0,
|
|
403
395
|
loop: !0,
|
|
404
396
|
muted: !0,
|
|
@@ -408,286 +400,292 @@ function je({ className: e }) {
|
|
|
408
400
|
}
|
|
409
401
|
);
|
|
410
402
|
}
|
|
411
|
-
|
|
412
|
-
|
|
403
|
+
const V = se(null);
|
|
404
|
+
function R() {
|
|
405
|
+
const e = oe(V);
|
|
406
|
+
if (!e)
|
|
407
|
+
throw new Error("SignUp.* components must be rendered inside <SignUp>");
|
|
408
|
+
return e;
|
|
413
409
|
}
|
|
414
|
-
function
|
|
415
|
-
const {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
410
|
+
function U(e) {
|
|
411
|
+
const { setAuthPending: r } = R();
|
|
412
|
+
k(() => (r(e), () => r(!1)), [e, r]);
|
|
413
|
+
}
|
|
414
|
+
const Me = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
415
|
+
function B(e) {
|
|
416
|
+
return Me.test(e.trim());
|
|
417
|
+
}
|
|
418
|
+
function $() {
|
|
419
|
+
const { goToStep: e, setEmail: r, setOtpSession: s } = S(), {
|
|
420
|
+
authPending: i,
|
|
421
|
+
emailAuthMethod: n,
|
|
422
|
+
needsAgreement: a,
|
|
423
|
+
guardAgreement: o,
|
|
424
|
+
setError: c
|
|
425
|
+
} = R(), [l, p] = z(""), h = n === "otp", { mutateAsync: v, isPending: b } = F(), { mutateAsync: f, isPending: y } = W(), u = b || y;
|
|
426
|
+
U(u);
|
|
427
|
+
const x = async () => {
|
|
428
|
+
if (!(!l || i) && B(l) && o()) {
|
|
429
|
+
c(null);
|
|
430
|
+
try {
|
|
431
|
+
const g = h ? v : f, { otpId: L, otpEncryptionTargetBundle: P } = await g({
|
|
432
|
+
email: l
|
|
433
|
+
});
|
|
434
|
+
r(l), s({ otpId: L, otpEncryptionTargetBundle: P }), e(h ? "otp-input" : "email-verification");
|
|
435
|
+
} catch (g) {
|
|
436
|
+
c(
|
|
437
|
+
g instanceof Error ? g.message : "Failed to send verification code"
|
|
438
|
+
);
|
|
424
439
|
}
|
|
425
440
|
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
441
|
+
};
|
|
442
|
+
return /* @__PURE__ */ t(
|
|
443
|
+
Z,
|
|
444
|
+
{
|
|
445
|
+
iconName: "email",
|
|
446
|
+
placeholder: "Enter your email",
|
|
447
|
+
value: l,
|
|
448
|
+
onChange: (g) => p(g.target.value),
|
|
449
|
+
type: "email",
|
|
450
|
+
autoCapitalize: "none",
|
|
451
|
+
autoComplete: "email",
|
|
452
|
+
disabled: i,
|
|
453
|
+
variant: "listItemStyle",
|
|
454
|
+
onKeyDown: (g) => {
|
|
455
|
+
g.key === "Enter" && l && !i && x();
|
|
431
456
|
},
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
457
|
+
children: u ? /* @__PURE__ */ t("div", { className: "zd:w-13 zd:h-13 zd:flex zd:items-center zd:justify-center", children: /* @__PURE__ */ t("div", { className: "zd:w-5 zd:h-5 zd:border-2 zd:border-solarOrange zd:border-t-transparent zd:rounded-full zd:animate-spin" }) }) : /* @__PURE__ */ t(
|
|
458
|
+
"button",
|
|
459
|
+
{
|
|
460
|
+
type: "button",
|
|
461
|
+
disabled: !B(l) || a,
|
|
462
|
+
className: `zd:w-13 zd:h-13 zd:rounded-2xl zd:flex zd:items-center zd:justify-center zd:transition-colors ${B(l) && !a ? "zd:cursor-pointer" : "zd:cursor-not-allowed zd:opacity-50"}`,
|
|
463
|
+
onClick: () => x(),
|
|
464
|
+
children: /* @__PURE__ */ t(ee, { name: "chevronRight", className: "zd:text-greyScale" })
|
|
465
|
+
}
|
|
466
|
+
)
|
|
436
467
|
}
|
|
437
|
-
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
function G(e) {
|
|
471
|
+
return e instanceof Error ? e.name === "AbortError" || e.name === "NotAllowedError" ? !0 : e.message.toLowerCase().includes("oauth popup was closed") : !1;
|
|
472
|
+
}
|
|
473
|
+
function K() {
|
|
474
|
+
const { goToStep: e } = S(), { authPending: r, guardAgreement: s, setError: i } = R(), { mutateAsync: n, isPending: a } = ue({
|
|
438
475
|
mutation: {
|
|
439
476
|
onSuccess: () => {
|
|
440
|
-
|
|
441
|
-
e("authenticated"), (o = t == null ? void 0 : t.onSuccess) == null || o.call(t);
|
|
442
|
-
},
|
|
443
|
-
onError: (o) => {
|
|
444
|
-
var z;
|
|
445
|
-
_(o) || y(o instanceof Error ? o.message : String(o)), (z = t == null ? void 0 : t.onError) == null || z.call(t, o);
|
|
477
|
+
e("authenticated");
|
|
446
478
|
}
|
|
447
479
|
}
|
|
448
|
-
})
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
if (L) {
|
|
466
|
-
l(!0);
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
y(null);
|
|
470
|
-
try {
|
|
471
|
-
await H({ provider: "google" });
|
|
472
|
-
} catch (o) {
|
|
473
|
-
const z = o instanceof Error ? o.message : String(o);
|
|
474
|
-
_(o) || y(z);
|
|
475
|
-
}
|
|
476
|
-
}, W = f ? async () => {
|
|
477
|
-
if (!(!h || b) && j(h)) {
|
|
478
|
-
if (L) {
|
|
479
|
-
l(!0);
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
y(null);
|
|
483
|
-
try {
|
|
484
|
-
const { otpId: o, otpEncryptionTargetBundle: z } = await N({
|
|
485
|
-
email: h
|
|
486
|
-
});
|
|
487
|
-
s(h), a({ otpId: o, otpEncryptionTargetBundle: z }), e("otp-input");
|
|
488
|
-
} catch (o) {
|
|
489
|
-
y(
|
|
490
|
-
o instanceof Error ? o.message : "Failed to send verification code"
|
|
491
|
-
);
|
|
480
|
+
});
|
|
481
|
+
return U(a), /* @__PURE__ */ t(
|
|
482
|
+
_,
|
|
483
|
+
{
|
|
484
|
+
icon: /* @__PURE__ */ t(q, { name: "google" }),
|
|
485
|
+
title: "Google",
|
|
486
|
+
trailing: /* @__PURE__ */ t(te, {}),
|
|
487
|
+
disabled: r,
|
|
488
|
+
onClick: async () => {
|
|
489
|
+
if (!r && s()) {
|
|
490
|
+
i(null);
|
|
491
|
+
try {
|
|
492
|
+
await n({ provider: "google" });
|
|
493
|
+
} catch (c) {
|
|
494
|
+
G(c) || i(c instanceof Error ? c.message : String(c));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
492
497
|
}
|
|
493
498
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
email: h
|
|
504
|
-
});
|
|
505
|
-
s(h), a({ otpId: o, otpEncryptionTargetBundle: z }), e("email-verification");
|
|
506
|
-
} catch (o) {
|
|
507
|
-
y(
|
|
508
|
-
o instanceof Error ? o.message : "Failed to send verification code"
|
|
509
|
-
);
|
|
510
|
-
}
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
function Y() {
|
|
502
|
+
const { goToStep: e } = S(), { authPending: r, guardAgreement: s, setError: i } = R(), n = {
|
|
503
|
+
onSuccess: () => {
|
|
504
|
+
e("authenticated");
|
|
505
|
+
},
|
|
506
|
+
onError: (h) => {
|
|
507
|
+
G(h) || i(h instanceof Error ? h.message : String(h));
|
|
511
508
|
}
|
|
509
|
+
}, { mutate: a, isPending: o } = pe({ mutation: n }), { mutate: c, isPending: l } = he({
|
|
510
|
+
mutation: n
|
|
511
|
+
});
|
|
512
|
+
U(o || l);
|
|
513
|
+
const p = (h) => () => {
|
|
514
|
+
r || s() && (i(null), h());
|
|
512
515
|
};
|
|
513
|
-
return
|
|
514
|
-
/* @__PURE__ */
|
|
515
|
-
|
|
516
|
-
/* @__PURE__ */ n(
|
|
517
|
-
E,
|
|
516
|
+
return /* @__PURE__ */ d(N, { children: [
|
|
517
|
+
/* @__PURE__ */ t(
|
|
518
|
+
w,
|
|
518
519
|
{
|
|
519
|
-
action: "
|
|
520
|
-
text: "
|
|
521
|
-
|
|
520
|
+
action: "secondary",
|
|
521
|
+
text: "Create a passkey",
|
|
522
|
+
iconName: "key",
|
|
523
|
+
trailIcon: !0,
|
|
524
|
+
disabled: r,
|
|
525
|
+
onClick: p(() => a())
|
|
526
|
+
}
|
|
527
|
+
),
|
|
528
|
+
/* @__PURE__ */ t(
|
|
529
|
+
w,
|
|
530
|
+
{
|
|
531
|
+
action: "secondary",
|
|
532
|
+
text: "Log in with passkey",
|
|
533
|
+
iconName: "key",
|
|
534
|
+
trailIcon: !0,
|
|
535
|
+
disabled: r,
|
|
536
|
+
onClick: p(() => c())
|
|
522
537
|
}
|
|
523
538
|
)
|
|
524
|
-
] })
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
iconName: "key",
|
|
551
|
-
trailIcon: !0,
|
|
552
|
-
disabled: b,
|
|
553
|
-
onClick: ee
|
|
554
|
-
}
|
|
555
|
-
)
|
|
556
|
-
] }),
|
|
557
|
-
/* @__PURE__ */ c("div", { className: "zd:flex zd:items-center zd:gap-3", children: [
|
|
558
|
-
/* @__PURE__ */ n("div", { className: "zd:h-px zd:flex-1 zd:bg-greyScale/30" }),
|
|
559
|
-
/* @__PURE__ */ n(m, { className: "zd:text-body3", children: "or" }),
|
|
560
|
-
/* @__PURE__ */ n("div", { className: "zd:h-px zd:flex-1 zd:bg-greyScale/30" })
|
|
561
|
-
] })
|
|
562
|
-
] }),
|
|
563
|
-
/* @__PURE__ */ c("div", { className: "zd:px-4 zd:flex zd:flex-col zd:gap-2", children: [
|
|
564
|
-
r.includes("google") && /* @__PURE__ */ n(
|
|
565
|
-
$,
|
|
539
|
+
] });
|
|
540
|
+
}
|
|
541
|
+
function J({
|
|
542
|
+
children: e,
|
|
543
|
+
termsAndConditionsUrl: r,
|
|
544
|
+
privacyPolicyUrl: s,
|
|
545
|
+
emailAuthMethod: i = "magicLink"
|
|
546
|
+
}) {
|
|
547
|
+
const [n, a] = z(!1), [o, c] = z(!1), [l, p] = z(null), [h, v] = z(!1), f = !!(r || s) && !n, y = () => f ? (c(!0), !1) : !0;
|
|
548
|
+
return /* @__PURE__ */ d(
|
|
549
|
+
V.Provider,
|
|
550
|
+
{
|
|
551
|
+
value: {
|
|
552
|
+
authPending: h,
|
|
553
|
+
emailAuthMethod: i,
|
|
554
|
+
setAuthPending: v,
|
|
555
|
+
needsAgreement: f,
|
|
556
|
+
guardAgreement: y,
|
|
557
|
+
setError: p
|
|
558
|
+
},
|
|
559
|
+
children: [
|
|
560
|
+
l !== null && /* @__PURE__ */ t("div", { className: "zd:flex zd:items-center zd:justify-center zd:h-full", children: /* @__PURE__ */ d("div", { className: "zd:flex zd:flex-col zd:gap-4 zd:max-w-md", children: [
|
|
561
|
+
/* @__PURE__ */ t(m, { className: "zd:text-h2 zd:text-center", children: "Error occurred" }),
|
|
562
|
+
/* @__PURE__ */ t(m, { className: "zd:text-center zd:text-red-500", children: l }),
|
|
563
|
+
/* @__PURE__ */ t(
|
|
564
|
+
w,
|
|
566
565
|
{
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
className: "zd:rounded-3xl",
|
|
571
|
-
disabled: b,
|
|
572
|
-
onClick: te
|
|
566
|
+
action: "primary",
|
|
567
|
+
text: "Try again",
|
|
568
|
+
onClick: () => p(null)
|
|
573
569
|
}
|
|
574
|
-
)
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
children: g ? /* @__PURE__ */ n("div", { className: "zd:w-13 zd:h-13 zd:flex zd:items-center zd:justify-center", children: /* @__PURE__ */ n("div", { className: "zd:w-5 zd:h-5 zd:border-2 zd:border-solarOrange zd:border-t-transparent zd:rounded-full zd:animate-spin" }) }) : /* @__PURE__ */ n(
|
|
592
|
-
"button",
|
|
570
|
+
)
|
|
571
|
+
] }) }),
|
|
572
|
+
/* @__PURE__ */ d(
|
|
573
|
+
"div",
|
|
574
|
+
{
|
|
575
|
+
className: `zd:flex-1 zd:flex zd:flex-col zd:justify-between zd:pb-4 zd:overflow-y-auto zd:overflow-x-hidden${l !== null ? " zd:hidden" : ""}`,
|
|
576
|
+
children: [
|
|
577
|
+
/* @__PURE__ */ d("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:justify-center", children: [
|
|
578
|
+
/* @__PURE__ */ d("div", { className: "zd:px-4 zd:flex zd:flex-col zd:items-center", children: [
|
|
579
|
+
/* @__PURE__ */ t("div", { className: "zd:w-full zd:px-16 zd:py-4", children: /* @__PURE__ */ t(Ue, { className: "zd:w-full zd:pointer-events-none zd:select-none" }) }),
|
|
580
|
+
/* @__PURE__ */ t(m, { className: "zd:text-h2 zd:text-center", children: "Continue to your wallet" }),
|
|
581
|
+
/* @__PURE__ */ t(m, { className: "zd:mt-2 zd:text-center zd:text-greyScale/50", children: "Choose a sign-in method to proceed" })
|
|
582
|
+
] }),
|
|
583
|
+
/* @__PURE__ */ t("div", { className: "zd:mt-6 zd:mb-4 zd:px-4 zd:flex zd:flex-col zd:gap-2", children: e })
|
|
584
|
+
] }),
|
|
585
|
+
/* @__PURE__ */ t("div", { className: "zd:px-4", children: /* @__PURE__ */ t(
|
|
586
|
+
Oe,
|
|
593
587
|
{
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
588
|
+
termsAndConditionsUrl: r,
|
|
589
|
+
privacyPolicyUrl: s,
|
|
590
|
+
agreedToTerms: n,
|
|
591
|
+
setAgreedToTerms: (u) => {
|
|
592
|
+
a(u), u && c(!1);
|
|
593
|
+
},
|
|
594
|
+
highlight: o
|
|
599
595
|
}
|
|
600
|
-
)
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
]
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
i(o), o && l(!1);
|
|
614
|
-
},
|
|
615
|
-
highlight: u
|
|
616
|
-
}
|
|
617
|
-
) })
|
|
596
|
+
) })
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
)
|
|
600
|
+
]
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
function X({ label: e = "or" }) {
|
|
605
|
+
return /* @__PURE__ */ d("div", { className: "zd:-mx-4 zd:my-2 zd:flex zd:items-center zd:gap-3", children: [
|
|
606
|
+
/* @__PURE__ */ t("div", { className: "zd:h-px zd:flex-1 zd:bg-greyScale/30" }),
|
|
607
|
+
/* @__PURE__ */ t(m, { className: "zd:text-body3", children: e }),
|
|
608
|
+
/* @__PURE__ */ t("div", { className: "zd:h-px zd:flex-1 zd:bg-greyScale/30" })
|
|
618
609
|
] });
|
|
619
610
|
}
|
|
620
|
-
function
|
|
621
|
-
return
|
|
611
|
+
function je(e) {
|
|
612
|
+
return /* @__PURE__ */ d(J, { ...e, children: [
|
|
613
|
+
/* @__PURE__ */ t(Y, {}),
|
|
614
|
+
/* @__PURE__ */ t(X, {}),
|
|
615
|
+
/* @__PURE__ */ t(K, {}),
|
|
616
|
+
/* @__PURE__ */ t($, {})
|
|
617
|
+
] });
|
|
622
618
|
}
|
|
619
|
+
const He = Object.assign(J, {
|
|
620
|
+
Default: je,
|
|
621
|
+
Passkey: Y,
|
|
622
|
+
Google: K,
|
|
623
|
+
Email: $,
|
|
624
|
+
Divider: X
|
|
625
|
+
});
|
|
623
626
|
function _e() {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
clearOtpSession: t,
|
|
629
|
-
config: r
|
|
630
|
-
} = R(), [d] = w(Fe), [i, u] = w(null), l = K(!1), { mutate: h, isPending: x } = fe({
|
|
627
|
+
return typeof window > "u" ? null : new URLSearchParams(window.location.search).get("code");
|
|
628
|
+
}
|
|
629
|
+
function qe() {
|
|
630
|
+
const { otpId: e, otpEncryptionTargetBundle: r, goToStep: s, clearOtpSession: i } = S(), [n] = z(_e), [a, o] = z(null), c = D(!1), { mutate: l, isPending: p } = me({
|
|
631
631
|
mutation: {
|
|
632
|
-
onSuccess:
|
|
633
|
-
|
|
634
|
-
t(), a("authenticated"), (f = r == null ? void 0 : r.onSuccess) == null || f.call(r);
|
|
632
|
+
onSuccess: () => {
|
|
633
|
+
i(), s("authenticated");
|
|
635
634
|
},
|
|
636
|
-
onError: (
|
|
637
|
-
|
|
638
|
-
u(f), (N = r == null ? void 0 : r.onError) == null || N.call(r, f);
|
|
635
|
+
onError: (h) => {
|
|
636
|
+
o(h);
|
|
639
637
|
}
|
|
640
638
|
}
|
|
641
639
|
});
|
|
642
|
-
return
|
|
643
|
-
if (!(
|
|
644
|
-
if (
|
|
645
|
-
|
|
640
|
+
return k(() => {
|
|
641
|
+
if (!(c.current || !n)) {
|
|
642
|
+
if (c.current = !0, !e || !r) {
|
|
643
|
+
A(), s(null);
|
|
646
644
|
return;
|
|
647
645
|
}
|
|
648
|
-
|
|
646
|
+
l({ otpId: e, code: n, otpEncryptionTargetBundle: r });
|
|
649
647
|
}
|
|
650
|
-
}, [e,
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
!
|
|
653
|
-
!
|
|
654
|
-
/* @__PURE__ */
|
|
648
|
+
}, [e, r, n, l, s]), /* @__PURE__ */ d(N, { children: [
|
|
649
|
+
/* @__PURE__ */ d("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center", children: [
|
|
650
|
+
!a && p && /* @__PURE__ */ t(E, { imageName: "loading", title: "Verifying Your Email", children: "Please wait while we securely connect your wallet." }),
|
|
651
|
+
!a && !n && !p && /* @__PURE__ */ d(N, { children: [
|
|
652
|
+
/* @__PURE__ */ d(E, { imageName: "error", title: "Invalid Link", children: [
|
|
655
653
|
"This verification link is invalid or incomplete.",
|
|
656
|
-
/* @__PURE__ */
|
|
654
|
+
/* @__PURE__ */ t("br", {}),
|
|
657
655
|
"Please check your email and try again with the correct link."
|
|
658
656
|
] }),
|
|
659
|
-
/* @__PURE__ */
|
|
660
|
-
|
|
657
|
+
/* @__PURE__ */ t(
|
|
658
|
+
w,
|
|
661
659
|
{
|
|
662
660
|
action: "primary",
|
|
663
661
|
onClick: () => {
|
|
664
|
-
|
|
662
|
+
A(), s("sign-up");
|
|
665
663
|
},
|
|
666
664
|
text: "Choose another sign-in method"
|
|
667
665
|
}
|
|
668
666
|
)
|
|
669
667
|
] }),
|
|
670
|
-
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
/* @__PURE__ */
|
|
673
|
-
|
|
668
|
+
a != null && /* @__PURE__ */ d(N, { children: [
|
|
669
|
+
/* @__PURE__ */ t(E, { imageName: "error", title: "Oops, something went wrong", children: "We couldn't complete the sign-in process. This could be due to timeout, an expired link, or a cancelled request." }),
|
|
670
|
+
/* @__PURE__ */ t(
|
|
671
|
+
w,
|
|
674
672
|
{
|
|
675
673
|
action: "primary",
|
|
676
674
|
onClick: () => {
|
|
677
|
-
|
|
675
|
+
A(), s("sign-up");
|
|
678
676
|
},
|
|
679
677
|
text: "Choose another sign-in method"
|
|
680
678
|
}
|
|
681
679
|
)
|
|
682
680
|
] })
|
|
683
681
|
] }),
|
|
684
|
-
/* @__PURE__ */
|
|
682
|
+
/* @__PURE__ */ t(T, { className: "zd:self-center zd:pt-4 zd:pb-6" })
|
|
685
683
|
] });
|
|
686
684
|
}
|
|
687
|
-
function
|
|
688
|
-
const { goToStep: e } =
|
|
689
|
-
|
|
690
|
-
{ connector:
|
|
685
|
+
function De() {
|
|
686
|
+
const { goToStep: e } = S(), { connect: r, connectors: s, isPending: i } = ce(), n = s.filter((o) => o.id !== "zerodev-wallet"), a = (o) => {
|
|
687
|
+
r(
|
|
688
|
+
{ connector: o },
|
|
691
689
|
{
|
|
692
690
|
onSuccess: () => {
|
|
693
691
|
e(null);
|
|
@@ -695,104 +693,107 @@ function qe() {
|
|
|
695
693
|
}
|
|
696
694
|
);
|
|
697
695
|
};
|
|
698
|
-
return /* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
/* @__PURE__ */
|
|
702
|
-
|
|
696
|
+
return /* @__PURE__ */ d(N, { children: [
|
|
697
|
+
/* @__PURE__ */ d("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center", children: [
|
|
698
|
+
/* @__PURE__ */ t(m, { className: "zd:text-h2 zd:text-center", children: "Select your wallet" }),
|
|
699
|
+
/* @__PURE__ */ t("div", { className: "zd:flex zd:flex-col zd:gap-2", children: n.length === 0 ? /* @__PURE__ */ t(m, { className: "zd:text-center", children: "No wallets detected. Install a browser wallet extension to continue." }) : n.map((o) => /* @__PURE__ */ t(
|
|
700
|
+
_,
|
|
703
701
|
{
|
|
704
|
-
title:
|
|
705
|
-
icon:
|
|
702
|
+
title: o.name,
|
|
703
|
+
icon: o.icon ? /* @__PURE__ */ t(
|
|
706
704
|
"img",
|
|
707
705
|
{
|
|
708
|
-
src:
|
|
706
|
+
src: o.icon,
|
|
709
707
|
alt: "",
|
|
710
708
|
className: "zd:w-6 zd:h-6"
|
|
711
709
|
}
|
|
712
|
-
) : /* @__PURE__ */
|
|
713
|
-
disabled:
|
|
714
|
-
onClick: () =>
|
|
710
|
+
) : /* @__PURE__ */ t(q, { name: "walletOutline" }),
|
|
711
|
+
disabled: i,
|
|
712
|
+
onClick: () => a(o),
|
|
715
713
|
className: "zd:rounded-3xl"
|
|
716
714
|
},
|
|
717
|
-
|
|
715
|
+
o.uid
|
|
718
716
|
)) })
|
|
719
717
|
] }),
|
|
720
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ t(T, { className: "zd:self-center zd:pt-4 zd:pb-6" })
|
|
721
719
|
] });
|
|
722
720
|
}
|
|
723
721
|
const We = {
|
|
724
722
|
"wallet-selection": "Choose your wallet"
|
|
725
723
|
};
|
|
726
|
-
function
|
|
727
|
-
return /* @__PURE__ */
|
|
724
|
+
function Fe() {
|
|
725
|
+
return /* @__PURE__ */ t("div", { className: "zd:flex zd:flex-1 zd:items-center zd:justify-center", children: /* @__PURE__ */ t(E, { imageName: "loading", title: "Authenticating...", children: "Please wait while we complete the OAuth authentication." }) });
|
|
728
726
|
}
|
|
729
|
-
function
|
|
730
|
-
return /* @__PURE__ */
|
|
727
|
+
function Ve() {
|
|
728
|
+
return /* @__PURE__ */ t("div", { className: "zd:flex zd:flex-1 zd:items-center zd:justify-center", children: /* @__PURE__ */ t(E, { imageName: "loading", title: "Passkey authentication", children: "Please authenticate with your passkey." }) });
|
|
731
729
|
}
|
|
732
|
-
function $e(e) {
|
|
730
|
+
function $e(e, r) {
|
|
733
731
|
switch (e) {
|
|
734
732
|
case "sign-up":
|
|
735
|
-
return /* @__PURE__ */
|
|
733
|
+
return r ? r() : /* @__PURE__ */ t(He.Default, {});
|
|
736
734
|
case "email-verification":
|
|
737
|
-
return /* @__PURE__ */
|
|
735
|
+
return /* @__PURE__ */ t(be, {});
|
|
738
736
|
case "otp-input":
|
|
739
|
-
return /* @__PURE__ */
|
|
737
|
+
return /* @__PURE__ */ t(Le, {});
|
|
740
738
|
case "verifying-otp":
|
|
741
|
-
return /* @__PURE__ */
|
|
739
|
+
return /* @__PURE__ */ t(qe, {});
|
|
742
740
|
case "oauth-in-progress":
|
|
743
|
-
return /* @__PURE__ */
|
|
741
|
+
return /* @__PURE__ */ t(Fe, {});
|
|
744
742
|
case "passkey-prompt":
|
|
745
|
-
return /* @__PURE__ */
|
|
743
|
+
return /* @__PURE__ */ t(Ve, {});
|
|
746
744
|
case "wallet-selection":
|
|
747
|
-
return /* @__PURE__ */
|
|
745
|
+
return /* @__PURE__ */ t(De, {});
|
|
748
746
|
case "error":
|
|
749
|
-
return /* @__PURE__ */
|
|
747
|
+
return /* @__PURE__ */ t(ke, {});
|
|
750
748
|
default:
|
|
751
749
|
return null;
|
|
752
750
|
}
|
|
753
751
|
}
|
|
754
|
-
function
|
|
752
|
+
function st({
|
|
755
753
|
onClose: e,
|
|
756
|
-
size:
|
|
754
|
+
size: r,
|
|
755
|
+
renderSignUp: s,
|
|
756
|
+
logo: i
|
|
757
757
|
} = {}) {
|
|
758
|
-
const { step:
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}, [
|
|
762
|
-
const
|
|
763
|
-
if (!
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
}, h =
|
|
767
|
-
return /* @__PURE__ */
|
|
768
|
-
|
|
758
|
+
const { step: n, goToStep: a, goBack: o, reset: c } = S();
|
|
759
|
+
k(() => {
|
|
760
|
+
n === null && Ee() && a("verifying-otp");
|
|
761
|
+
}, [n, a]);
|
|
762
|
+
const l = $e(n, s);
|
|
763
|
+
if (!l) return null;
|
|
764
|
+
const p = () => {
|
|
765
|
+
A(), c(), e == null || e();
|
|
766
|
+
}, h = n ? We[n] : void 0;
|
|
767
|
+
return /* @__PURE__ */ t(
|
|
768
|
+
ne,
|
|
769
769
|
{
|
|
770
|
-
...
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
770
|
+
...r && { size: r },
|
|
771
|
+
className: n === "sign-up" ? "zd:h-auto zd:max-h-202.5" : void 0,
|
|
772
|
+
contentClassName: n === "sign-up" ? "zd:px-0" : void 0,
|
|
773
|
+
topNav: /* @__PURE__ */ t(
|
|
774
|
+
re,
|
|
774
775
|
{
|
|
775
|
-
...
|
|
776
|
-
onRightButtonClick:
|
|
776
|
+
...o !== null && { onLeftButtonClick: o },
|
|
777
|
+
onRightButtonClick: p,
|
|
777
778
|
...h && { title: h },
|
|
778
|
-
...
|
|
779
|
+
...n === "sign-up" && {
|
|
779
780
|
...i && { logo: i },
|
|
780
781
|
className: "zd:px-4"
|
|
781
782
|
}
|
|
782
783
|
}
|
|
783
784
|
),
|
|
784
|
-
children:
|
|
785
|
+
children: l
|
|
785
786
|
}
|
|
786
787
|
);
|
|
787
788
|
}
|
|
788
|
-
const
|
|
789
|
-
function
|
|
789
|
+
const M = "zerodev:auth:otpSession";
|
|
790
|
+
function Ge() {
|
|
790
791
|
if (typeof window > "u") return null;
|
|
791
792
|
try {
|
|
792
|
-
const e = window.localStorage.getItem(
|
|
793
|
+
const e = window.localStorage.getItem(M);
|
|
793
794
|
if (!e) return null;
|
|
794
|
-
const
|
|
795
|
-
return !(
|
|
795
|
+
const r = JSON.parse(e);
|
|
796
|
+
return !(r != null && r.otpId) || !(r != null && r.otpEncryptionTargetBundle) ? null : r;
|
|
796
797
|
} catch {
|
|
797
798
|
return null;
|
|
798
799
|
}
|
|
@@ -801,69 +802,63 @@ function Ke(e) {
|
|
|
801
802
|
if (!(typeof window > "u"))
|
|
802
803
|
try {
|
|
803
804
|
window.localStorage.setItem(
|
|
804
|
-
|
|
805
|
+
M,
|
|
805
806
|
JSON.stringify(e)
|
|
806
807
|
);
|
|
807
808
|
} catch {
|
|
808
809
|
}
|
|
809
810
|
}
|
|
810
|
-
function
|
|
811
|
+
function j() {
|
|
811
812
|
if (!(typeof window > "u"))
|
|
812
813
|
try {
|
|
813
|
-
window.localStorage.removeItem(
|
|
814
|
+
window.localStorage.removeItem(M);
|
|
814
815
|
} catch {
|
|
815
816
|
}
|
|
816
817
|
}
|
|
817
|
-
const Ye = (e,
|
|
818
|
+
const Ye = (e, r, s) => ({
|
|
818
819
|
auth: {
|
|
819
820
|
// Initial state
|
|
820
821
|
step: null,
|
|
821
822
|
stepHistory: [],
|
|
822
|
-
enabledMethods: [],
|
|
823
823
|
email: null,
|
|
824
824
|
otpId: null,
|
|
825
825
|
otpEncryptionTargetBundle: null,
|
|
826
|
-
config: null,
|
|
827
826
|
// Actions
|
|
828
|
-
initialize: (
|
|
829
|
-
const
|
|
830
|
-
e((
|
|
827
|
+
initialize: () => {
|
|
828
|
+
const i = Ge();
|
|
829
|
+
i && e((n) => ({
|
|
831
830
|
auth: {
|
|
832
|
-
...
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
...r && {
|
|
836
|
-
otpId: r.otpId,
|
|
837
|
-
otpEncryptionTargetBundle: r.otpEncryptionTargetBundle
|
|
838
|
-
}
|
|
831
|
+
...n.auth,
|
|
832
|
+
otpId: i.otpId,
|
|
833
|
+
otpEncryptionTargetBundle: i.otpEncryptionTargetBundle
|
|
839
834
|
}
|
|
840
835
|
}));
|
|
841
836
|
},
|
|
842
|
-
goToStep: (
|
|
843
|
-
e((
|
|
837
|
+
goToStep: (i) => {
|
|
838
|
+
e((n) => ({
|
|
844
839
|
auth: {
|
|
845
|
-
...
|
|
846
|
-
step:
|
|
847
|
-
stepHistory:
|
|
840
|
+
...n.auth,
|
|
841
|
+
step: i,
|
|
842
|
+
stepHistory: n.auth.step === null ? n.auth.stepHistory : [...n.auth.stepHistory, n.auth.step]
|
|
848
843
|
}
|
|
849
844
|
}));
|
|
850
845
|
},
|
|
851
846
|
goBack: () => {
|
|
852
|
-
const { auth:
|
|
853
|
-
if (
|
|
854
|
-
const
|
|
855
|
-
e((
|
|
847
|
+
const { auth: i } = r();
|
|
848
|
+
if (i.stepHistory.length === 0) return;
|
|
849
|
+
const n = [...i.stepHistory], a = n.pop();
|
|
850
|
+
e((o) => ({
|
|
856
851
|
auth: {
|
|
857
|
-
...
|
|
858
|
-
step:
|
|
859
|
-
stepHistory:
|
|
852
|
+
...o.auth,
|
|
853
|
+
step: a,
|
|
854
|
+
stepHistory: n
|
|
860
855
|
}
|
|
861
856
|
}));
|
|
862
857
|
},
|
|
863
858
|
reset: () => {
|
|
864
|
-
|
|
859
|
+
j(), e((i) => ({
|
|
865
860
|
auth: {
|
|
866
|
-
...
|
|
861
|
+
...i.auth,
|
|
867
862
|
step: null,
|
|
868
863
|
stepHistory: [],
|
|
869
864
|
email: null,
|
|
@@ -872,95 +867,93 @@ const Ye = (e, s, a) => ({
|
|
|
872
867
|
}
|
|
873
868
|
}));
|
|
874
869
|
},
|
|
875
|
-
setEmail: (
|
|
876
|
-
e((
|
|
870
|
+
setEmail: (i) => {
|
|
871
|
+
e((n) => ({
|
|
877
872
|
auth: {
|
|
878
|
-
...
|
|
879
|
-
email:
|
|
873
|
+
...n.auth,
|
|
874
|
+
email: i
|
|
880
875
|
}
|
|
881
876
|
}));
|
|
882
877
|
},
|
|
883
|
-
setOtpSession: ({ otpId:
|
|
884
|
-
Ke({ otpId:
|
|
878
|
+
setOtpSession: ({ otpId: i, otpEncryptionTargetBundle: n }) => {
|
|
879
|
+
Ke({ otpId: i, otpEncryptionTargetBundle: n }), e((a) => ({
|
|
885
880
|
auth: {
|
|
886
|
-
...
|
|
887
|
-
otpId:
|
|
888
|
-
otpEncryptionTargetBundle:
|
|
881
|
+
...a.auth,
|
|
882
|
+
otpId: i,
|
|
883
|
+
otpEncryptionTargetBundle: n
|
|
889
884
|
}
|
|
890
885
|
}));
|
|
891
886
|
},
|
|
892
887
|
clearOtpSession: () => {
|
|
893
|
-
|
|
888
|
+
j(), e((i) => ({
|
|
894
889
|
auth: {
|
|
895
|
-
...
|
|
890
|
+
...i.auth,
|
|
896
891
|
otpId: null,
|
|
897
892
|
otpEncryptionTargetBundle: null
|
|
898
893
|
}
|
|
899
894
|
}));
|
|
900
895
|
}
|
|
901
896
|
}
|
|
902
|
-
}), Je = (
|
|
903
|
-
|
|
897
|
+
}), Je = () => ae()(
|
|
898
|
+
ze((e, r, s) => ({
|
|
904
899
|
pendingRequests: [],
|
|
905
900
|
userConfirmationListenerActive: !1,
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
pendingRequests: [...d.pendingRequests, r]
|
|
901
|
+
addPendingRequest: (i) => e((n) => ({
|
|
902
|
+
pendingRequests: [...n.pendingRequests, i]
|
|
909
903
|
})),
|
|
910
|
-
removePendingRequest: (
|
|
911
|
-
pendingRequests:
|
|
904
|
+
removePendingRequest: (i) => e((n) => ({
|
|
905
|
+
pendingRequests: n.pendingRequests.filter((a) => a.id !== i)
|
|
912
906
|
})),
|
|
913
|
-
clearPendingRequests: () =>
|
|
914
|
-
setUserConfirmationListenerActive: (
|
|
915
|
-
...Ye(
|
|
907
|
+
clearPendingRequests: () => e({ pendingRequests: [] }),
|
|
908
|
+
setUserConfirmationListenerActive: (i) => e({ userConfirmationListenerActive: i }),
|
|
909
|
+
...Ye(e, r)
|
|
916
910
|
}))
|
|
917
911
|
);
|
|
918
912
|
function Xe(e) {
|
|
919
|
-
return new Promise((
|
|
920
|
-
const
|
|
921
|
-
(
|
|
922
|
-
(
|
|
923
|
-
|
|
913
|
+
return new Promise((r, s) => {
|
|
914
|
+
const i = e.subscribe(
|
|
915
|
+
(n) => n.auth.step,
|
|
916
|
+
(n) => {
|
|
917
|
+
n === "authenticated" ? (i(), r()) : n === null && (i(), s(new Error("Auth flow dismissed")));
|
|
924
918
|
}
|
|
925
919
|
);
|
|
926
920
|
});
|
|
927
921
|
}
|
|
928
|
-
function
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
const i = s(d);
|
|
922
|
+
function ot(e) {
|
|
923
|
+
const r = fe(e), s = Je();
|
|
924
|
+
return (i) => {
|
|
925
|
+
const n = r(i);
|
|
933
926
|
return {
|
|
934
|
-
...
|
|
935
|
-
async connect(
|
|
936
|
-
var l;
|
|
927
|
+
...n,
|
|
928
|
+
async connect(a) {
|
|
937
929
|
try {
|
|
938
|
-
return await
|
|
939
|
-
} catch (
|
|
940
|
-
if (
|
|
941
|
-
throw
|
|
942
|
-
if (
|
|
930
|
+
return await n.connect(a);
|
|
931
|
+
} catch (o) {
|
|
932
|
+
if (a != null && a.isReconnecting || !(o instanceof ge))
|
|
933
|
+
throw o;
|
|
934
|
+
if (s.getState().auth.step !== null)
|
|
943
935
|
throw new Error("Auth flow already in progress");
|
|
944
|
-
return
|
|
936
|
+
return s.getState().auth.goToStep("sign-up"), await Xe(s), n.connect(a);
|
|
945
937
|
}
|
|
946
938
|
},
|
|
947
939
|
async disconnect() {
|
|
948
|
-
var
|
|
949
|
-
await ((
|
|
940
|
+
var a;
|
|
941
|
+
await ((a = n.disconnect) == null ? void 0 : a.call(n)), s.getState().auth.reset();
|
|
950
942
|
},
|
|
951
943
|
async setup() {
|
|
952
|
-
var
|
|
953
|
-
await ((
|
|
944
|
+
var a;
|
|
945
|
+
await ((a = n.setup) == null ? void 0 : a.call(n)), !(typeof window > "u") && s.getState().auth.initialize();
|
|
954
946
|
},
|
|
955
947
|
getKitStore() {
|
|
956
|
-
return
|
|
948
|
+
return s;
|
|
957
949
|
}
|
|
958
950
|
};
|
|
959
951
|
};
|
|
960
952
|
}
|
|
961
953
|
export {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
954
|
+
st as ConnectWallet,
|
|
955
|
+
He as SignUp,
|
|
956
|
+
S as useAuth,
|
|
957
|
+
ot as zeroDevWallet
|
|
965
958
|
};
|
|
966
959
|
//# sourceMappingURL=index.mjs.map
|