@krak-stack/auth 0.1.52 → 0.1.53
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/admin/api.group.d.ts +60 -0
- package/dist/admin/schema.d.ts +64 -0
- package/dist/admin/schema.js +41 -0
- package/dist/api.d.ts +297 -216
- package/dist/components/admin-organization-form.js +110 -69
- package/dist/components/admin-organizations.js +99 -6
- package/dist/components/admin-users.js +38 -4
- package/dist/components/auth-client-api.d.ts +60 -0
- package/dist/components/auth-client.d.ts +4 -0
- package/dist/components/auth-client.js +4 -0
- package/dist/components/auth-forms.js +274 -292
- package/dist/components/organization-switcher.d.ts +9 -1
- package/dist/components/organization-switcher.js +236 -191
- package/dist/components/user-button.js +197 -178
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +2 -0
- package/dist/server/api.group.d.ts +22 -1
- package/dist/server/api.group.js +10 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/schema.d.ts +20 -0
- package/dist/server/schema.js +5 -0
- package/dist/service.d.ts +50 -0
- package/package.json +1 -1
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAtomSuspense } from "@effect/atom-react";
|
|
2
|
+
import { useAtomSet, useAtomSuspense, useAtomValue } from "@effect/atom-react";
|
|
3
|
+
import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
|
|
3
4
|
import { Link, useNavigate, useRouterState } from "@tanstack/react-router";
|
|
4
|
-
import { Schema } from "effect";
|
|
5
|
+
import { Effect, Option, Schema } from "effect";
|
|
5
6
|
import { Atom, AsyncResult } from "effect/unstable/reactivity";
|
|
6
7
|
import { REGEXP_ONLY_DIGITS } from "input-otp";
|
|
7
|
-
import { KeyRound, Mail } from "lucide-react";
|
|
8
|
+
import { KeyRound, Loader2, Mail } from "lucide-react";
|
|
8
9
|
import { useEffect, useState } from "react";
|
|
9
10
|
import { Button, buttonVariants } from "@/components/ui/button";
|
|
10
11
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card";
|
|
12
|
+
import { CheckboxField, ErrorMessage, SubmitError, TextField, effectFormMessages, } from "@/components/ui/effect-form";
|
|
11
13
|
import { Field, FieldLabel } from "@/components/ui/field";
|
|
12
|
-
import { FieldError, useAppForm } from "@/components/ui/form";
|
|
13
14
|
import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, } from "@/components/ui/input-otp";
|
|
14
15
|
import { authClientApi } from "./auth-client-api";
|
|
15
16
|
import { useKrakstackAuth } from "./auth-provider";
|
|
16
17
|
import { cn } from "./utils";
|
|
17
18
|
import { ExtraProjectPublicConfig as ExtraProjectPublicConfigSchema, } from "../extra/schema";
|
|
18
19
|
const EMAIL_OTP_RESEND_COOLDOWN_SECONDS = 60;
|
|
20
|
+
const signinFormBuilder = FormBuilder.empty
|
|
21
|
+
.addField("email", Schema.String)
|
|
22
|
+
.addField("password", Schema.String)
|
|
23
|
+
.addField("otp", Schema.String);
|
|
24
|
+
const signupFormBuilder = FormBuilder.empty
|
|
25
|
+
.addField("name", Schema.String)
|
|
26
|
+
.addField("email", Schema.String)
|
|
27
|
+
.addField("password", Schema.String);
|
|
28
|
+
const verifyEmailFormBuilder = FormBuilder.empty
|
|
29
|
+
.addField("email", Schema.String)
|
|
30
|
+
.addField("otp", Schema.String);
|
|
31
|
+
const resetPasswordFormBuilder = FormBuilder.empty.addField("password", Schema.String);
|
|
32
|
+
const twoFactorFormBuilder = FormBuilder.empty
|
|
33
|
+
.addField("code", Schema.String)
|
|
34
|
+
.addField("trustDevice", Schema.Boolean);
|
|
19
35
|
const defaultMessages = {
|
|
20
36
|
en: {
|
|
21
37
|
auth_continue_with_google: "Continue with Google",
|
|
@@ -226,23 +242,56 @@ export function Signin(props) {
|
|
|
226
242
|
const interval = window.setInterval(updateResendSeconds, 1000);
|
|
227
243
|
return () => window.clearInterval(interval);
|
|
228
244
|
}, [emailOtpResendAvailableAt]);
|
|
229
|
-
const form =
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
245
|
+
const [form] = useState(() => FormReact.make(signinFormBuilder, {
|
|
246
|
+
fields: { email: TextField, password: TextField, otp: OtpField },
|
|
247
|
+
mode: { validation: "onSubmit" },
|
|
248
|
+
onSubmit: (action, { decoded: value }) => Effect.tryPromise({
|
|
249
|
+
try: async () => {
|
|
250
|
+
const email = value.email.trim();
|
|
251
|
+
const sendEmailOtp = async () => {
|
|
252
|
+
const result = await authClient.emailOtp.sendVerificationOtp({
|
|
253
|
+
email,
|
|
254
|
+
type: "sign-in",
|
|
255
|
+
});
|
|
256
|
+
if (result.error) {
|
|
257
|
+
throw new Error(result.error.message ?? m.sign_in_email_otp_send_error);
|
|
258
|
+
}
|
|
259
|
+
setAuthMethod("emailOtp");
|
|
260
|
+
setEmailSubmitted(true);
|
|
261
|
+
setOtpSentTo(email);
|
|
262
|
+
setEmailOtpResendAvailableAt(Date.now() + EMAIL_OTP_RESEND_COOLDOWN_SECONDS * 1000);
|
|
263
|
+
};
|
|
264
|
+
if (action.type === "social") {
|
|
265
|
+
const result = await authClient.signIn.social({
|
|
266
|
+
provider: "google",
|
|
267
|
+
callbackURL: socialRedirectTarget,
|
|
268
|
+
errorCallbackURL: "/sign-in",
|
|
269
|
+
...(oauthQuery
|
|
270
|
+
? { additionalData: { query: oauthQuery } }
|
|
271
|
+
: {}),
|
|
272
|
+
...(oauthQuery ? { oauth_query: oauthQuery } : {}),
|
|
273
|
+
});
|
|
274
|
+
if (result.error) {
|
|
275
|
+
throw new Error(result.error.message ?? m.sign_in_error);
|
|
276
|
+
}
|
|
277
|
+
if (result.data?.url)
|
|
278
|
+
onNavigate(result.data.url);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (action.type === "sendEmailOtp") {
|
|
282
|
+
await sendEmailOtp();
|
|
237
283
|
return;
|
|
238
284
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
285
|
+
if (!action.emailSubmitted) {
|
|
286
|
+
if (action.method === "emailOtp")
|
|
287
|
+
await sendEmailOtp();
|
|
288
|
+
else
|
|
289
|
+
setEmailSubmitted(true);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (action.method === "emailOtp") {
|
|
293
|
+
if (!action.otpSent) {
|
|
294
|
+
await sendEmailOtp();
|
|
246
295
|
return;
|
|
247
296
|
}
|
|
248
297
|
const result = await authClient.signIn.emailOtp({
|
|
@@ -250,13 +299,7 @@ export function Signin(props) {
|
|
|
250
299
|
otp: value.otp.trim(),
|
|
251
300
|
});
|
|
252
301
|
if (result.error) {
|
|
253
|
-
|
|
254
|
-
onSubmit: {
|
|
255
|
-
form: result.error.message ?? m.sign_in_email_otp_error,
|
|
256
|
-
fields: {},
|
|
257
|
-
},
|
|
258
|
-
});
|
|
259
|
-
return;
|
|
302
|
+
throw new Error(result.error.message ?? m.sign_in_email_otp_error);
|
|
260
303
|
}
|
|
261
304
|
onNavigate(redirectTarget);
|
|
262
305
|
return;
|
|
@@ -268,119 +311,81 @@ export function Signin(props) {
|
|
|
268
311
|
...(oauthQuery ? { oauth_query: oauthQuery } : {}),
|
|
269
312
|
});
|
|
270
313
|
if (result.error) {
|
|
271
|
-
|
|
272
|
-
onSubmit: {
|
|
273
|
-
form: result.error.message ?? m.sign_in_error,
|
|
274
|
-
fields: {},
|
|
275
|
-
},
|
|
276
|
-
});
|
|
277
|
-
return;
|
|
314
|
+
throw new Error(result.error.message ?? m.sign_in_error);
|
|
278
315
|
}
|
|
279
316
|
if (hasTwoFactorRedirect(result.data)) {
|
|
280
317
|
onTwoFactorRedirect(`/2fa${oauthQuery ? `?${oauthQuery}` : `?callbackURL=${encodeURIComponent(redirectTarget)}`}`);
|
|
281
318
|
return;
|
|
282
319
|
}
|
|
283
320
|
onNavigate(result.data?.url ?? redirectTarget);
|
|
284
|
-
}
|
|
285
|
-
catch
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
},
|
|
296
|
-
});
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
setEmailSubmitted(true);
|
|
309
|
-
setOtpSentTo(email);
|
|
310
|
-
setEmailOtpResendAvailableAt(Date.now() + EMAIL_OTP_RESEND_COOLDOWN_SECONDS * 1000);
|
|
311
|
-
}
|
|
312
|
-
catch {
|
|
313
|
-
setError(m.sign_in_email_otp_send_error);
|
|
314
|
-
}
|
|
315
|
-
};
|
|
321
|
+
},
|
|
322
|
+
catch: (cause) => cause instanceof Error
|
|
323
|
+
? cause
|
|
324
|
+
: new Error(action.type === "sendEmailOtp" ||
|
|
325
|
+
(action.type === "submit" &&
|
|
326
|
+
action.method === "emailOtp" &&
|
|
327
|
+
(!action.emailSubmitted || !action.otpSent))
|
|
328
|
+
? m.sign_in_email_otp_send_error
|
|
329
|
+
: action.type === "submit" && action.method === "emailOtp"
|
|
330
|
+
? m.sign_in_email_otp_error
|
|
331
|
+
: m.sign_in_error),
|
|
332
|
+
}),
|
|
333
|
+
}));
|
|
334
|
+
const submit = useAtomSet(form.submit);
|
|
335
|
+
const submitResult = useAtomValue(form.submit);
|
|
336
|
+
const formValues = Option.getOrElse(useAtomValue(form.values), () => ({
|
|
337
|
+
email: "",
|
|
338
|
+
password: "",
|
|
339
|
+
otp: "",
|
|
340
|
+
}));
|
|
341
|
+
const resetForm = useAtomSet(form.reset);
|
|
342
|
+
const setEmail = useAtomSet(form.getFieldAtoms(form.fields.email).setValue);
|
|
343
|
+
const setPassword = useAtomSet(form.getFieldAtoms(form.fields.password).setValue);
|
|
344
|
+
const setOtp = useAtomSet(form.getFieldAtoms(form.fields.otp).setValue);
|
|
316
345
|
const resetEmailStep = () => {
|
|
346
|
+
const email = formValues.email;
|
|
347
|
+
resetForm();
|
|
348
|
+
setEmail(email);
|
|
317
349
|
setEmailSubmitted(false);
|
|
318
350
|
setOtpSentTo("");
|
|
319
351
|
setEmailOtpResendAvailableAt(0);
|
|
320
|
-
form.setFieldValue("password", "");
|
|
321
|
-
form.setFieldValue("otp", "");
|
|
322
|
-
form.setErrorMap({ onSubmit: undefined });
|
|
323
352
|
};
|
|
324
|
-
const switchAuthMethod =
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
form.setFieldValue("otp", "");
|
|
353
|
+
const switchAuthMethod = () => {
|
|
354
|
+
setPassword("");
|
|
355
|
+
setOtp("");
|
|
328
356
|
if (selectedAuthMethod === "emailOtp") {
|
|
357
|
+
resetForm();
|
|
358
|
+
setEmail(formValues.email);
|
|
329
359
|
setAuthMethod("password");
|
|
330
360
|
setOtpSentTo("");
|
|
331
361
|
setEmailOtpResendAvailableAt(0);
|
|
332
362
|
return;
|
|
333
363
|
}
|
|
334
|
-
|
|
335
|
-
};
|
|
336
|
-
const resendEmailOtp = async () => {
|
|
337
|
-
form.setErrorMap({ onSubmit: undefined });
|
|
338
|
-
form.setFieldValue("otp", "");
|
|
339
|
-
await sendEmailOtp(form.state.values.email.trim(), (message) => form.setErrorMap({ onSubmit: { form: message, fields: {} } }));
|
|
364
|
+
submit({ type: "sendEmailOtp" });
|
|
340
365
|
};
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
provider: "google",
|
|
345
|
-
callbackURL: socialRedirectTarget,
|
|
346
|
-
errorCallbackURL: "/sign-in",
|
|
347
|
-
...(oauthQuery ? { additionalData: { query: oauthQuery } } : {}),
|
|
348
|
-
...(oauthQuery ? { oauth_query: oauthQuery } : {}),
|
|
349
|
-
});
|
|
350
|
-
if (result.error) {
|
|
351
|
-
form.setErrorMap({
|
|
352
|
-
onSubmit: {
|
|
353
|
-
form: result.error.message ?? m.sign_in_error,
|
|
354
|
-
fields: {},
|
|
355
|
-
},
|
|
356
|
-
});
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
if (result.data?.url)
|
|
360
|
-
onNavigate(result.data.url);
|
|
361
|
-
}
|
|
362
|
-
catch {
|
|
363
|
-
form.setErrorMap({ onSubmit: { form: m.sign_in_error, fields: {} } });
|
|
364
|
-
}
|
|
366
|
+
const resendEmailOtp = () => {
|
|
367
|
+
setOtp("");
|
|
368
|
+
submit({ type: "sendEmailOtp" });
|
|
365
369
|
};
|
|
366
|
-
|
|
370
|
+
const signInWithGoogle = () => submit({ type: "social" });
|
|
371
|
+
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.auth_sign_in }), _jsx(CardDescription, { children: !emailSubmitted ? (m.sign_in_description) : (_jsxs(_Fragment, { children: [text(m.sign_in_email_as, { email: formValues.email }), " ", _jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: resetEmailStep, children: m.sign_in_change_email })] })) })] }), _jsxs(CardContent, { children: [hasPrimaryAuth ? (_jsx(form.Initialize, { defaultValues: { email: "", password: "", otp: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
367
372
|
event.preventDefault();
|
|
368
373
|
event.stopPropagation();
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
submit({
|
|
375
|
+
type: "submit",
|
|
376
|
+
emailSubmitted,
|
|
377
|
+
method: selectedAuthMethod,
|
|
378
|
+
otpSent: Boolean(otpSentTo),
|
|
379
|
+
});
|
|
380
|
+
}, children: [!emailSubmitted ? (_jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", required: true })) : null, emailSubmitted && selectedAuthMethod === "password" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.password, { label: m.field_password, type: "password", autoComplete: "current-password", required: true }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [_jsx(Link, { className: authLinkClassName, to: "/forgot-password", search: searchObject(searchString), children: m.sign_in_forgot_password }), canChangeAuthMethod ? (_jsxs(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: switchAuthMethod, children: [_jsx(Mail, {}), m.sign_in_use_email_otp] })) : null] })] })) : null, emailSubmitted && selectedAuthMethod === "emailOtp" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.otp, { label: m.sign_in_email_otp_code }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [otpSentTo ? (_jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", disabled: emailOtpResendSeconds > 0, onClick: resendEmailOtp, children: emailOtpResendSeconds > 0
|
|
376
381
|
? text(m.sign_in_email_otp_resend_countdown, {
|
|
377
382
|
seconds: String(emailOtpResendSeconds),
|
|
378
383
|
})
|
|
379
|
-
: m.sign_in_email_otp_resend })) : null, canChangeAuthMethod ? (_jsxs(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: switchAuthMethod, children: [_jsx(KeyRound, {}), m.sign_in_use_password] })) : null] })] })) : null, _jsx(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
+
: m.sign_in_email_otp_resend })) : null, canChangeAuthMethod ? (_jsxs(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: switchAuthMethod, children: [_jsx(KeyRound, {}), m.sign_in_use_password] })) : null] })] })) : null, _jsx(SubmitError, { result: submitResult }), _jsx("div", { children: _jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, !emailSubmitted
|
|
385
|
+
? m.sign_in_continue
|
|
386
|
+
: selectedAuthMethod === "emailOtp"
|
|
387
|
+
? m.sign_in_email_otp_verify
|
|
388
|
+
: m.auth_sign_in] }) })] }) })) : null, options.google && !emailSubmitted ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [hasPrimaryAuth ? (_jsx(Divider, { label: m.auth_or_continue_with })) : null, _jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting, onClick: signInWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] })] })) : null, !hasPrimaryAuth && !options.google ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.oauth_client_no_auth_methods })) : null, options.signUp ? (_jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-up", search: searchObject(searchString), children: [m.sign_in_need_account, " ", m.auth_sign_up] }) })) : null] })] }));
|
|
384
389
|
}
|
|
385
390
|
export function Signup(props) {
|
|
386
391
|
const { authClient, baseUrl, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
|
|
@@ -401,17 +406,27 @@ export function Signup(props) {
|
|
|
401
406
|
signUp: authOptions?.signUp ?? true,
|
|
402
407
|
signUpName: authOptions?.signUpName ?? true,
|
|
403
408
|
};
|
|
404
|
-
const form =
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
409
|
+
const [form] = useState(() => FormReact.make(signupFormBuilder, {
|
|
410
|
+
fields: { name: TextField, email: TextField, password: TextField },
|
|
411
|
+
mode: { validation: "onSubmit" },
|
|
412
|
+
onSubmit: (action, { decoded: value }) => Effect.tryPromise({
|
|
413
|
+
try: async () => {
|
|
414
|
+
if (action === "social") {
|
|
415
|
+
const result = await authClient.signIn.social({
|
|
416
|
+
provider: "google",
|
|
417
|
+
callbackURL: redirectTarget,
|
|
418
|
+
errorCallbackURL: "/sign-up",
|
|
419
|
+
});
|
|
420
|
+
if (result.error) {
|
|
421
|
+
throw new Error(result.error.message ?? m.sign_up_error);
|
|
422
|
+
}
|
|
423
|
+
if (result.data?.url)
|
|
424
|
+
onNavigate(result.data.url);
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (!options.signUp) {
|
|
428
|
+
throw new Error(m.sign_up_disabled_description);
|
|
429
|
+
}
|
|
415
430
|
const result = await authClient.signUp.email({
|
|
416
431
|
name: options.signUpName
|
|
417
432
|
? value.name.trim()
|
|
@@ -420,54 +435,24 @@ export function Signup(props) {
|
|
|
420
435
|
password: value.password,
|
|
421
436
|
});
|
|
422
437
|
if (result.error) {
|
|
423
|
-
|
|
424
|
-
onSubmit: {
|
|
425
|
-
form: result.error.message ?? m.sign_up_error,
|
|
426
|
-
fields: {},
|
|
427
|
-
},
|
|
428
|
-
});
|
|
429
|
-
return;
|
|
438
|
+
throw new Error(result.error.message ?? m.sign_up_error);
|
|
430
439
|
}
|
|
431
440
|
onVerifyEmail(value.email.trim());
|
|
432
|
-
}
|
|
433
|
-
catch
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
});
|
|
440
|
-
const signUpWithGoogle = async () => {
|
|
441
|
-
try {
|
|
442
|
-
const result = await authClient.signIn.social({
|
|
443
|
-
provider: "google",
|
|
444
|
-
callbackURL: redirectTarget,
|
|
445
|
-
errorCallbackURL: "/sign-up",
|
|
446
|
-
});
|
|
447
|
-
if (result.error) {
|
|
448
|
-
form.setErrorMap({
|
|
449
|
-
onSubmit: {
|
|
450
|
-
form: result.error.message ?? m.sign_up_error,
|
|
451
|
-
fields: {},
|
|
452
|
-
},
|
|
453
|
-
});
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
if (result.data?.url)
|
|
457
|
-
onNavigate(result.data.url);
|
|
458
|
-
}
|
|
459
|
-
catch {
|
|
460
|
-
form.setErrorMap({ onSubmit: { form: m.sign_up_error, fields: {} } });
|
|
461
|
-
}
|
|
462
|
-
};
|
|
441
|
+
},
|
|
442
|
+
catch: (cause) => cause instanceof Error ? cause : new Error(m.sign_up_error),
|
|
443
|
+
}),
|
|
444
|
+
}));
|
|
445
|
+
const submit = useAtomSet(form.submit);
|
|
446
|
+
const submitResult = useAtomValue(form.submit);
|
|
447
|
+
const signUpWithGoogle = () => submit("social");
|
|
463
448
|
if (!options.signUp) {
|
|
464
449
|
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.sign_up_disabled_title }), _jsx(CardDescription, { children: m.sign_up_disabled_description })] }), _jsx(CardContent, { children: _jsx("p", { className: "text-muted-foreground text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: [m.sign_up_have_account, " ", m.auth_sign_in] }) }) })] }));
|
|
465
450
|
}
|
|
466
|
-
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.sign_up_title }), _jsx(CardDescription, { children: m.sign_up_description })] }), _jsxs(CardContent, { children: [_jsx(form.
|
|
451
|
+
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.sign_up_title }), _jsx(CardDescription, { children: m.sign_up_description })] }), _jsxs(CardContent, { children: [_jsx(form.Initialize, { defaultValues: { name: "", email: "", password: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
467
452
|
event.preventDefault();
|
|
468
453
|
event.stopPropagation();
|
|
469
|
-
|
|
470
|
-
}, children: [options.signUpName ? (_jsx(form.
|
|
454
|
+
submit("email");
|
|
455
|
+
}, children: [options.signUpName ? (_jsx(form.name, { label: m.field_name, autoComplete: "name", required: true })) : null, _jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", required: true }), _jsx(form.password, { label: m.field_password, type: "password", autoComplete: "new-password", minLength: 8, required: true }), _jsx(SubmitError, { result: submitResult }), _jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, effectFormMessages().submit] })] }) }), options.google ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [_jsx(Divider, { label: m.auth_or_continue_with }), _jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting, onClick: signUpWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] })] })) : null, _jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: [m.sign_up_have_account, " ", m.auth_sign_in] }) })] })] }));
|
|
471
456
|
}
|
|
472
457
|
export function VerifyEmail(props) {
|
|
473
458
|
const { authClient, baseUrl, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
|
|
@@ -479,54 +464,49 @@ export function VerifyEmail(props) {
|
|
|
479
464
|
const redirectTarget = getRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
|
|
480
465
|
const onNavigate = (target) => navigateTarget(target, navigate);
|
|
481
466
|
const [resent, setResent] = useState(false);
|
|
482
|
-
const form =
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
467
|
+
const [form] = useState(() => FormReact.make(verifyEmailFormBuilder, {
|
|
468
|
+
fields: { email: TextField, otp: OtpField },
|
|
469
|
+
mode: { validation: "onSubmit" },
|
|
470
|
+
onSubmit: (action, { decoded: value }) => Effect.tryPromise({
|
|
471
|
+
try: async () => {
|
|
472
|
+
if (action === "resend") {
|
|
473
|
+
const result = await authClient.emailOtp.sendVerificationOtp({
|
|
474
|
+
email: value.email.trim(),
|
|
475
|
+
type: "email-verification",
|
|
476
|
+
});
|
|
477
|
+
if (result.error) {
|
|
478
|
+
throw new Error(result.error.message ?? m.verify_email_resend_error);
|
|
479
|
+
}
|
|
480
|
+
setResent(true);
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
const result = await authClient.emailOtp.verifyEmail({
|
|
484
|
+
email: value.email.trim(),
|
|
485
|
+
otp: value.otp.trim(),
|
|
499
486
|
});
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
})
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
setResent(true);
|
|
521
|
-
};
|
|
522
|
-
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.verify_email_title }), _jsx(CardDescription, { children: m.verify_email_description })] }), _jsxs(CardContent, { children: [_jsx(form.AppForm, { children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
487
|
+
if (result.error) {
|
|
488
|
+
throw new Error(result.error.message ?? m.verify_email_error);
|
|
489
|
+
}
|
|
490
|
+
onNavigate(redirectTarget);
|
|
491
|
+
},
|
|
492
|
+
catch: (cause) => cause instanceof Error
|
|
493
|
+
? cause
|
|
494
|
+
: new Error(action === "resend"
|
|
495
|
+
? m.verify_email_resend_error
|
|
496
|
+
: m.verify_email_error),
|
|
497
|
+
}),
|
|
498
|
+
}));
|
|
499
|
+
const submit = useAtomSet(form.submit);
|
|
500
|
+
const submitResult = useAtomValue(form.submit);
|
|
501
|
+
const resendCode = () => submit("resend");
|
|
502
|
+
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.verify_email_title }), _jsx(CardDescription, { children: m.verify_email_description })] }), _jsxs(CardContent, { children: [_jsx(form.Initialize, { defaultValues: {
|
|
503
|
+
email: getSearchParam(searchString, "email") ?? "",
|
|
504
|
+
otp: "",
|
|
505
|
+
}, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
523
506
|
event.preventDefault();
|
|
524
507
|
event.stopPropagation();
|
|
525
|
-
|
|
526
|
-
}, children: [_jsx(form.
|
|
527
|
-
const invalid = !field.state.meta.isValid;
|
|
528
|
-
return (_jsxs(Field, { "data-invalid": invalid, children: [_jsx(FieldLabel, { htmlFor: field.name, children: m.verify_email_code }), _jsxs(InputOTP, { id: field.name, name: field.name, maxLength: 6, value: field.state.value ?? "", onChange: (value) => field.handleChange(value), onBlur: field.handleBlur, autoComplete: "one-time-code", inputMode: "numeric", pattern: REGEXP_ONLY_DIGITS, required: true, children: [_jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 0, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 1, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 2, "aria-invalid": invalid })] }), _jsx(InputOTPSeparator, {}), _jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 3, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 4, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 5, "aria-invalid": invalid })] })] }), _jsx(FieldError, { errors: field.getMeta().errors })] }));
|
|
529
|
-
} }), _jsx(form.FormError, {}), resent ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.verify_email_resent })) : null, _jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [_jsx(form.SubmitButton, {}), _jsx(Button, { type: "button", variant: "ghost", onClick: resendCode, children: m.verify_email_resend })] })] }) }), _jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsx(Link, { className: authLinkClassName, to: "/sign-in", children: m.forgot_password_back_to_sign_in }) })] })] }));
|
|
508
|
+
submit("verify");
|
|
509
|
+
}, children: [_jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", required: true }), _jsx(form.otp, { label: m.verify_email_code }), _jsx(SubmitError, { result: submitResult }), resent ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.verify_email_resent })) : null, _jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [_jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, effectFormMessages().submit] }), _jsx(Button, { type: "button", variant: "ghost", disabled: submitResult.waiting, onClick: resendCode, children: m.verify_email_resend })] })] }) }), _jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsx(Link, { className: authLinkClassName, to: "/sign-in", children: m.forgot_password_back_to_sign_in }) })] })] }));
|
|
530
510
|
}
|
|
531
511
|
export function ResetPassword(props) {
|
|
532
512
|
const { authClient, labels: m } = useAuthFormOptions(props);
|
|
@@ -536,37 +516,32 @@ export function ResetPassword(props) {
|
|
|
536
516
|
});
|
|
537
517
|
const token = getSearchParam(searchString, "token") ?? "";
|
|
538
518
|
const onSuccess = () => navigate({ to: "/sign-in" });
|
|
539
|
-
const form =
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
519
|
+
const [form] = useState(() => FormReact.make(resetPasswordFormBuilder, {
|
|
520
|
+
fields: { password: TextField },
|
|
521
|
+
mode: { validation: "onSubmit" },
|
|
522
|
+
onSubmit: (_, { decoded: value }) => Effect.tryPromise({
|
|
523
|
+
try: async () => {
|
|
524
|
+
if (!token)
|
|
525
|
+
throw new Error(m.reset_password_missing_token);
|
|
526
|
+
const result = await authClient.resetPassword({
|
|
527
|
+
newPassword: value.password,
|
|
528
|
+
token,
|
|
546
529
|
});
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
},
|
|
559
|
-
});
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
onSuccess();
|
|
563
|
-
},
|
|
564
|
-
});
|
|
565
|
-
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.reset_password_title }), _jsx(CardDescription, { children: m.reset_password_description })] }), _jsx(CardContent, { children: _jsx(form.AppForm, { children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
530
|
+
if (result.error) {
|
|
531
|
+
throw new Error(result.error.message ?? m.reset_password_error);
|
|
532
|
+
}
|
|
533
|
+
onSuccess();
|
|
534
|
+
},
|
|
535
|
+
catch: (cause) => cause instanceof Error ? cause : new Error(m.reset_password_error),
|
|
536
|
+
}),
|
|
537
|
+
}));
|
|
538
|
+
const submit = useAtomSet(form.submit);
|
|
539
|
+
const submitResult = useAtomValue(form.submit);
|
|
540
|
+
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.reset_password_title }), _jsx(CardDescription, { children: m.reset_password_description })] }), _jsx(CardContent, { children: _jsx(form.Initialize, { defaultValues: { password: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
566
541
|
event.preventDefault();
|
|
567
542
|
event.stopPropagation();
|
|
568
|
-
|
|
569
|
-
}, children: [_jsx(form.
|
|
543
|
+
submit();
|
|
544
|
+
}, children: [_jsx(form.password, { label: m.reset_password_new_password, type: "password", autoComplete: "new-password", minLength: 8, required: true }), _jsx(SubmitError, { result: submitResult }), _jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, effectFormMessages().submit] })] }) }) })] }));
|
|
570
545
|
}
|
|
571
546
|
export function TwoFactor(props) {
|
|
572
547
|
const { authClient, baseUrl, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
|
|
@@ -580,72 +555,79 @@ export function TwoFactor(props) {
|
|
|
580
555
|
const onNavigate = (target) => navigateTarget(target, navigate);
|
|
581
556
|
const [mode, setMode] = useState("totp");
|
|
582
557
|
const [emailCodeSent, setEmailCodeSent] = useState(false);
|
|
583
|
-
const form =
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
558
|
+
const [form] = useState(() => FormReact.make(twoFactorFormBuilder, {
|
|
559
|
+
fields: { code: AuthCodeField, trustDevice: CheckboxField },
|
|
560
|
+
mode: { validation: "onSubmit" },
|
|
561
|
+
onSubmit: (action, { decoded: value }) => Effect.tryPromise({
|
|
562
|
+
try: async () => {
|
|
563
|
+
if (action.type === "sendEmailCode") {
|
|
564
|
+
const result = await authClient.twoFactor.sendOtp();
|
|
565
|
+
if (result.error) {
|
|
566
|
+
throw new Error(result.error.message ?? m.two_factor_send_email_code_error);
|
|
567
|
+
}
|
|
568
|
+
setEmailCodeSent(true);
|
|
569
|
+
setMode("email");
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
const code = value.code.trim();
|
|
573
|
+
const result = action.mode === "backup"
|
|
574
|
+
? await authClient.twoFactor.verifyBackupCode({
|
|
596
575
|
code,
|
|
597
576
|
trustDevice: value.trustDevice,
|
|
598
577
|
...(oauthQuery ? { oauth_query: oauthQuery } : {}),
|
|
599
578
|
})
|
|
600
|
-
:
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
});
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
setEmailCodeSent(true);
|
|
630
|
-
setMode("email");
|
|
631
|
-
};
|
|
579
|
+
: action.mode === "email"
|
|
580
|
+
? await authClient.twoFactor.verifyOtp({
|
|
581
|
+
code,
|
|
582
|
+
trustDevice: value.trustDevice,
|
|
583
|
+
...(oauthQuery ? { oauth_query: oauthQuery } : {}),
|
|
584
|
+
})
|
|
585
|
+
: await authClient.twoFactor.verifyTotp({
|
|
586
|
+
code,
|
|
587
|
+
trustDevice: value.trustDevice,
|
|
588
|
+
...(oauthQuery ? { oauth_query: oauthQuery } : {}),
|
|
589
|
+
});
|
|
590
|
+
if (result.error) {
|
|
591
|
+
throw new Error(result.error.message ?? m.two_factor_verify_error);
|
|
592
|
+
}
|
|
593
|
+
onNavigate(getResultRedirectUrl(result.data) ?? redirectTarget);
|
|
594
|
+
},
|
|
595
|
+
catch: (cause) => cause instanceof Error
|
|
596
|
+
? cause
|
|
597
|
+
: new Error(action.type === "sendEmailCode"
|
|
598
|
+
? m.two_factor_send_email_code_error
|
|
599
|
+
: m.two_factor_verify_error),
|
|
600
|
+
}),
|
|
601
|
+
}));
|
|
602
|
+
const submit = useAtomSet(form.submit);
|
|
603
|
+
const submitResult = useAtomValue(form.submit);
|
|
604
|
+
const sendEmailCode = () => submit({ type: "sendEmailCode" });
|
|
632
605
|
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.two_factor_title }), _jsx(CardDescription, { children: mode === "backup"
|
|
633
606
|
? m.two_factor_verify_backup_description
|
|
634
607
|
: mode === "email"
|
|
635
608
|
? m.two_factor_verify_email_description
|
|
636
|
-
: m.two_factor_verify_description })] }), _jsx(CardContent, { children: _jsx(form.
|
|
609
|
+
: m.two_factor_verify_description })] }), _jsx(CardContent, { children: _jsx(form.Initialize, { defaultValues: { code: "", trustDevice: true }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
637
610
|
event.preventDefault();
|
|
638
611
|
event.stopPropagation();
|
|
639
|
-
|
|
640
|
-
}, children: [_jsx(form.
|
|
612
|
+
submit({ type: "verify", mode });
|
|
613
|
+
}, children: [_jsx(form.code, { autoComplete: "one-time-code", label: mode === "backup"
|
|
614
|
+
? m.two_factor_backup_code
|
|
615
|
+
: mode === "email"
|
|
641
616
|
? m.two_factor_email_code
|
|
642
|
-
: m.two_factor_code
|
|
617
|
+
: m.two_factor_code, otp: mode !== "backup", required: true }), _jsx(form.trustDevice, { label: m.two_factor_trust_device }), _jsx(SubmitError, { result: submitResult }), emailCodeSent && mode === "email" ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.two_factor_email_code_sent })) : null, _jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [_jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, effectFormMessages().submit] }), _jsx(Button, { type: "button", variant: "ghost", disabled: submitResult.waiting, onClick: sendEmailCode, children: m.two_factor_send_email_code }), _jsx(Button, { type: "button", variant: "ghost", onClick: () => setMode(mode === "backup" ? "totp" : "backup"), children: mode === "backup"
|
|
643
618
|
? m.two_factor_use_totp
|
|
644
619
|
: m.two_factor_use_backup_code })] })] }) }) })] }));
|
|
645
620
|
}
|
|
646
|
-
const
|
|
647
|
-
const invalid =
|
|
648
|
-
return (_jsxs(Field, { "data-invalid": invalid, children: [_jsx(FieldLabel, { htmlFor: field.
|
|
621
|
+
const OtpField = ({ field, props, }) => {
|
|
622
|
+
const invalid = Option.isSome(field.error);
|
|
623
|
+
return (_jsxs(Field, { "data-invalid": invalid, children: [_jsx(FieldLabel, { htmlFor: field.path, children: props.label }), _jsxs(InputOTP, { id: field.path, name: field.path, maxLength: 6, value: field.value, onChange: field.onChange, onBlur: field.onBlur, autoComplete: "one-time-code", inputMode: "numeric", pattern: REGEXP_ONLY_DIGITS, required: true, children: [_jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 0, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 1, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 2, "aria-invalid": invalid })] }), _jsx(InputOTPSeparator, {}), _jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 3, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 4, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 5, "aria-invalid": invalid })] })] }), Option.isSome(field.error) ? (_jsx(ErrorMessage, { text: field.error.value })) : null] }));
|
|
624
|
+
};
|
|
625
|
+
const AuthCodeField = ({ field, props }) => {
|
|
626
|
+
if (props.otp) {
|
|
627
|
+
return _jsx(OtpField, { field: field, props: { label: props.label } });
|
|
628
|
+
}
|
|
629
|
+
const { otp: _, ...textFieldProps } = props;
|
|
630
|
+
return _jsx(TextField, { field: field, props: textFieldProps });
|
|
649
631
|
};
|
|
650
632
|
const Divider = ({ label }) => (_jsxs("div", { className: "text-muted-foreground flex items-center gap-3 text-xs", children: [_jsx("span", { className: "bg-border h-px flex-1" }), label, _jsx("span", { className: "bg-border h-px flex-1" })] }));
|
|
651
633
|
const GoogleLogo = () => (_jsxs("svg", { "aria-hidden": "true", className: "size-[18px]", viewBox: "0 0 18 18", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M17.64 9.204c0-.638-.057-1.252-.164-1.84H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.874 2.684-6.616Z", fill: "#4285F4" }), _jsx("path", { d: "M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.583-5.036-3.711H.957v2.332A8.997 8.997 0 0 0 9 18Z", fill: "#34A853" }), _jsx("path", { d: "M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332Z", fill: "#FBBC05" }), _jsx("path", { d: "M9 3.58c1.321 0 2.508.454 3.44 1.346l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.162 6.656 3.58 9 3.58Z", fill: "#EA4335" })] }));
|