@mesob/auth-react 0.3.1 → 0.3.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/components/auth/auth-card.js +2 -1
- package/dist/components/auth/auth-card.js.map +1 -1
- package/dist/components/auth/forgot-password.js +49 -41
- package/dist/components/auth/forgot-password.js.map +1 -1
- package/dist/components/auth/reset-password-form.js +125 -108
- package/dist/components/auth/reset-password-form.js.map +1 -1
- package/dist/components/auth/sign-in.js +132 -97
- package/dist/components/auth/sign-in.js.map +1 -1
- package/dist/components/auth/sign-up.js +130 -125
- package/dist/components/auth/sign-up.js.map +1 -1
- package/dist/components/auth/verification-form.js +59 -49
- package/dist/components/auth/verification-form.js.map +1 -1
- package/dist/components/auth/verify-email.js +59 -49
- package/dist/components/auth/verify-email.js.map +1 -1
- package/dist/components/auth/verify-phone.js +59 -49
- package/dist/components/auth/verify-phone.js.map +1 -1
- package/dist/components/error-boundary.d.ts +2 -2
- package/dist/components/profile/change-email-form.js +59 -49
- package/dist/components/profile/change-email-form.js.map +1 -1
- package/dist/components/profile/change-phone-form.js +59 -49
- package/dist/components/profile/change-phone-form.js.map +1 -1
- package/dist/components/profile/otp-verification-modal.js +59 -49
- package/dist/components/profile/otp-verification-modal.js.map +1 -1
- package/dist/components/profile/security.js +59 -49
- package/dist/components/profile/security.js.map +1 -1
- package/dist/components/profile/verify-change-email-form.js +59 -49
- package/dist/components/profile/verify-change-email-form.js.map +1 -1
- package/dist/components/profile/verify-change-phone-form.js +59 -49
- package/dist/components/profile/verify-change-phone-form.js.map +1 -1
- package/dist/index.js +506 -430
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/components/auth/auth-card.tsx
|
|
4
|
+
import { Card } from "@mesob/ui/components";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
var AuthCard = ({ children }) => {
|
|
6
|
-
return /* @__PURE__ */ jsx("div", { className: "flex min-h-screen w-full p-4 items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "w-full min-w-[280px] max-w-[28rem] shrink-0", children: /* @__PURE__ */ jsx(
|
|
7
|
+
return /* @__PURE__ */ jsx("div", { className: "flex min-h-screen w-full p-4 items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "w-full min-w-[280px] max-w-[28rem] shrink-0", children: /* @__PURE__ */ jsx(Card, { padding: "lg", children }) }) });
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
// src/components/auth/forgot-password.tsx
|
|
@@ -13,17 +14,19 @@ import {
|
|
|
13
14
|
AlertDescription,
|
|
14
15
|
AlertTitle,
|
|
15
16
|
Button,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
Form,
|
|
18
|
+
FormControl,
|
|
19
|
+
FormField,
|
|
20
|
+
FormItem,
|
|
21
|
+
FormLabel,
|
|
22
|
+
FormMessage,
|
|
20
23
|
Input,
|
|
21
24
|
Spinner
|
|
22
25
|
} from "@mesob/ui/components";
|
|
23
26
|
import { useMesob as useMesob2 } from "@mesob/ui/providers";
|
|
24
27
|
import { IconAlertCircle } from "@tabler/icons-react";
|
|
25
28
|
import { useEffect, useState as useState2 } from "react";
|
|
26
|
-
import {
|
|
29
|
+
import { useForm } from "react-hook-form";
|
|
27
30
|
import { toast } from "sonner";
|
|
28
31
|
import { z } from "zod";
|
|
29
32
|
|
|
@@ -530,42 +533,48 @@ var ForgotPassword = () => {
|
|
|
530
533
|
}
|
|
531
534
|
),
|
|
532
535
|
children: [
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
536
|
+
/* @__PURE__ */ jsx4(Form, { ...form, children: /* @__PURE__ */ jsxs2(
|
|
537
|
+
"form",
|
|
538
|
+
{
|
|
539
|
+
id: "forgot-password-form",
|
|
540
|
+
onSubmit: handleSubmit,
|
|
541
|
+
className: "space-y-4",
|
|
542
|
+
children: [
|
|
543
|
+
/* @__PURE__ */ jsx4(
|
|
544
|
+
FormField,
|
|
545
|
+
{
|
|
546
|
+
control: form.control,
|
|
547
|
+
name: "account",
|
|
548
|
+
render: ({ field }) => /* @__PURE__ */ jsxs2(FormItem, { children: [
|
|
549
|
+
/* @__PURE__ */ jsx4(FormLabel, { children: t("form.accountLabel") }),
|
|
550
|
+
/* @__PURE__ */ jsx4(FormControl, { children: /* @__PURE__ */ jsx4(
|
|
551
|
+
Input,
|
|
552
|
+
{
|
|
553
|
+
...field,
|
|
554
|
+
type: "text",
|
|
555
|
+
placeholder: t("form.accountPlaceholder")
|
|
556
|
+
}
|
|
557
|
+
) }),
|
|
558
|
+
/* @__PURE__ */ jsx4(FormMessage, {})
|
|
559
|
+
] })
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
/* @__PURE__ */ jsxs2(
|
|
563
|
+
Button,
|
|
564
|
+
{
|
|
565
|
+
type: "submit",
|
|
566
|
+
form: "forgot-password-form",
|
|
567
|
+
className: "w-full",
|
|
568
|
+
disabled: isLoading || forgotPasswordMutation.isPending,
|
|
569
|
+
children: [
|
|
570
|
+
isLoading || forgotPasswordMutation.isPending && /* @__PURE__ */ jsx4(Spinner, {}),
|
|
571
|
+
isLoading || forgotPasswordMutation.isPending ? t("form.submitting") : t("form.submit")
|
|
572
|
+
]
|
|
573
|
+
}
|
|
574
|
+
)
|
|
575
|
+
]
|
|
576
|
+
}
|
|
577
|
+
) }),
|
|
569
578
|
errorContent && /* @__PURE__ */ jsxs2(Alert, { variant: "destructive", className: "mt-4", children: [
|
|
570
579
|
/* @__PURE__ */ jsx4(IconAlertCircle, { className: "h-4 w-4" }),
|
|
571
580
|
/* @__PURE__ */ jsx4(AlertTitle, { children: errorContent.title }),
|
|
@@ -583,23 +592,59 @@ import {
|
|
|
583
592
|
AlertDescription as AlertDescription2,
|
|
584
593
|
AlertTitle as AlertTitle2,
|
|
585
594
|
Button as Button2,
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
595
|
+
Form as Form2,
|
|
596
|
+
FormControl as FormControl2,
|
|
597
|
+
FormField as FormField2,
|
|
598
|
+
FormItem as FormItem2,
|
|
599
|
+
FormLabel as FormLabel2,
|
|
600
|
+
FormMessage as FormMessage2,
|
|
590
601
|
Input as Input2,
|
|
591
602
|
InputOTP,
|
|
592
603
|
InputOTPGroup,
|
|
593
604
|
InputOTPSlot,
|
|
594
|
-
Spinner as Spinner2
|
|
605
|
+
Spinner as Spinner2,
|
|
606
|
+
useFormField
|
|
595
607
|
} from "@mesob/ui/components";
|
|
596
608
|
import { useMesob as useMesob3 } from "@mesob/ui/providers";
|
|
597
609
|
import { IconAlertCircle as IconAlertCircle2, IconEye, IconEyeOff } from "@tabler/icons-react";
|
|
598
610
|
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
599
|
-
import {
|
|
611
|
+
import { useForm as useForm2 } from "react-hook-form";
|
|
600
612
|
import { toast as toast2 } from "sonner";
|
|
601
613
|
import { z as z2 } from "zod";
|
|
602
614
|
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
615
|
+
function PasswordInput({
|
|
616
|
+
field,
|
|
617
|
+
show,
|
|
618
|
+
onToggle,
|
|
619
|
+
placeholder
|
|
620
|
+
}) {
|
|
621
|
+
const { formItemId, error } = useFormField();
|
|
622
|
+
return /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
623
|
+
/* @__PURE__ */ jsx5(
|
|
624
|
+
Input2,
|
|
625
|
+
{
|
|
626
|
+
...field,
|
|
627
|
+
id: formItemId,
|
|
628
|
+
type: show ? "text" : "password",
|
|
629
|
+
placeholder,
|
|
630
|
+
"aria-invalid": !!error,
|
|
631
|
+
className: "pr-10"
|
|
632
|
+
}
|
|
633
|
+
),
|
|
634
|
+
/* @__PURE__ */ jsx5(
|
|
635
|
+
Button2,
|
|
636
|
+
{
|
|
637
|
+
type: "button",
|
|
638
|
+
variant: "ghost",
|
|
639
|
+
size: "icon",
|
|
640
|
+
className: "absolute right-0 top-0 h-full px-3 text-muted-foreground hover:text-foreground",
|
|
641
|
+
onClick: onToggle,
|
|
642
|
+
"aria-label": show ? "Hide password" : "Show password",
|
|
643
|
+
children: show ? /* @__PURE__ */ jsx5(IconEyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx5(IconEye, { className: "h-4 w-4" })
|
|
644
|
+
}
|
|
645
|
+
)
|
|
646
|
+
] });
|
|
647
|
+
}
|
|
603
648
|
var resetPasswordSchema = (t) => z2.object({
|
|
604
649
|
code: z2.string().length(6, t("errors.codeLength")),
|
|
605
650
|
password: z2.string().min(8, t("errors.passwordLength")),
|
|
@@ -717,117 +762,98 @@ var ResetPasswordForm = ({
|
|
|
717
762
|
)
|
|
718
763
|
] }),
|
|
719
764
|
children: [
|
|
720
|
-
/* @__PURE__ */
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
containerClassName: "gap-4",
|
|
737
|
-
"aria-invalid": fieldState.invalid,
|
|
738
|
-
children: /* @__PURE__ */ jsxs3(InputOTPGroup, { className: "gap-3 *:data-[slot=input-otp-slot]:h-12 *:data-[slot=input-otp-slot]:w-12 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:text-xl", children: [
|
|
739
|
-
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 0 }),
|
|
740
|
-
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 1 }),
|
|
741
|
-
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 2 }),
|
|
742
|
-
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 3 }),
|
|
743
|
-
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 4 }),
|
|
744
|
-
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 5 })
|
|
745
|
-
] })
|
|
746
|
-
}
|
|
747
|
-
) }),
|
|
748
|
-
fieldState.invalid && /* @__PURE__ */ jsx5(FieldError2, { errors: [fieldState.error] })
|
|
749
|
-
] })
|
|
750
|
-
}
|
|
751
|
-
),
|
|
752
|
-
/* @__PURE__ */ jsx5(
|
|
753
|
-
Controller2,
|
|
754
|
-
{
|
|
755
|
-
name: "password",
|
|
756
|
-
control: form.control,
|
|
757
|
-
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs3(Field2, { "data-invalid": fieldState.invalid, children: [
|
|
758
|
-
/* @__PURE__ */ jsx5(FieldLabel2, { htmlFor: "reset-password-password", children: t("form.passwordLabel") }),
|
|
759
|
-
/* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
760
|
-
/* @__PURE__ */ jsx5(
|
|
761
|
-
Input2,
|
|
762
|
-
{
|
|
763
|
-
...field,
|
|
764
|
-
id: "reset-password-password",
|
|
765
|
-
type: showPassword ? "text" : "password",
|
|
766
|
-
placeholder: t("form.passwordPlaceholder"),
|
|
767
|
-
"aria-invalid": fieldState.invalid
|
|
768
|
-
}
|
|
769
|
-
),
|
|
770
|
-
/* @__PURE__ */ jsx5(
|
|
771
|
-
"button",
|
|
765
|
+
/* @__PURE__ */ jsx5(Form2, { ...form, children: /* @__PURE__ */ jsxs3(
|
|
766
|
+
"form",
|
|
767
|
+
{
|
|
768
|
+
id: "reset-password-form",
|
|
769
|
+
onSubmit: handleSubmit,
|
|
770
|
+
className: "space-y-4",
|
|
771
|
+
children: [
|
|
772
|
+
/* @__PURE__ */ jsx5(
|
|
773
|
+
FormField2,
|
|
774
|
+
{
|
|
775
|
+
control: form.control,
|
|
776
|
+
name: "code",
|
|
777
|
+
render: ({ field }) => /* @__PURE__ */ jsxs3(FormItem2, { children: [
|
|
778
|
+
/* @__PURE__ */ jsx5("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx5(FormLabel2, { children: t("form.codeLabel") }) }),
|
|
779
|
+
/* @__PURE__ */ jsx5(FormControl2, { children: /* @__PURE__ */ jsx5(
|
|
780
|
+
InputOTP,
|
|
772
781
|
{
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
782
|
+
maxLength: 6,
|
|
783
|
+
value: field.value,
|
|
784
|
+
onChange: field.onChange,
|
|
785
|
+
onBlur: field.onBlur,
|
|
786
|
+
containerClassName: "gap-4 flex justify-center mt-2",
|
|
787
|
+
children: /* @__PURE__ */ jsxs3(InputOTPGroup, { className: "gap-3 *:data-[slot=input-otp-slot]:h-12 *:data-[slot=input-otp-slot]:w-12 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:text-xl", children: [
|
|
788
|
+
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 0 }),
|
|
789
|
+
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 1 }),
|
|
790
|
+
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 2 }),
|
|
791
|
+
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 3 }),
|
|
792
|
+
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 4 }),
|
|
793
|
+
/* @__PURE__ */ jsx5(InputOTPSlot, { className: "h-12", index: 5 })
|
|
794
|
+
] })
|
|
777
795
|
}
|
|
778
|
-
)
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
/* @__PURE__ */ jsx5(FieldLabel2, { htmlFor: "reset-password-confirmPassword", children: t("form.confirmPasswordLabel") }),
|
|
791
|
-
/* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
796
|
+
) }),
|
|
797
|
+
/* @__PURE__ */ jsx5(FormMessage2, {})
|
|
798
|
+
] })
|
|
799
|
+
}
|
|
800
|
+
),
|
|
801
|
+
/* @__PURE__ */ jsx5(
|
|
802
|
+
FormField2,
|
|
803
|
+
{
|
|
804
|
+
control: form.control,
|
|
805
|
+
name: "password",
|
|
806
|
+
render: ({ field }) => /* @__PURE__ */ jsxs3(FormItem2, { children: [
|
|
807
|
+
/* @__PURE__ */ jsx5(FormLabel2, { children: t("form.passwordLabel") }),
|
|
792
808
|
/* @__PURE__ */ jsx5(
|
|
793
|
-
|
|
809
|
+
PasswordInput,
|
|
794
810
|
{
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
placeholder: t("form.passwordPlaceholder")
|
|
799
|
-
"aria-invalid": fieldState.invalid
|
|
811
|
+
field,
|
|
812
|
+
show: showPassword,
|
|
813
|
+
onToggle: () => setShowPassword(!showPassword),
|
|
814
|
+
placeholder: t("form.passwordPlaceholder")
|
|
800
815
|
}
|
|
801
816
|
),
|
|
817
|
+
/* @__PURE__ */ jsx5(FormMessage2, {})
|
|
818
|
+
] })
|
|
819
|
+
}
|
|
820
|
+
),
|
|
821
|
+
/* @__PURE__ */ jsx5(
|
|
822
|
+
FormField2,
|
|
823
|
+
{
|
|
824
|
+
control: form.control,
|
|
825
|
+
name: "confirmPassword",
|
|
826
|
+
render: ({ field }) => /* @__PURE__ */ jsxs3(FormItem2, { children: [
|
|
827
|
+
/* @__PURE__ */ jsx5(FormLabel2, { children: t("form.confirmPasswordLabel") }),
|
|
802
828
|
/* @__PURE__ */ jsx5(
|
|
803
|
-
|
|
829
|
+
PasswordInput,
|
|
804
830
|
{
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
831
|
+
field,
|
|
832
|
+
show: showPassword,
|
|
833
|
+
onToggle: () => setShowPassword(!showPassword),
|
|
834
|
+
placeholder: t("form.passwordPlaceholder")
|
|
809
835
|
}
|
|
810
|
-
)
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
836
|
+
),
|
|
837
|
+
/* @__PURE__ */ jsx5(FormMessage2, {})
|
|
838
|
+
] })
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
/* @__PURE__ */ jsxs3(
|
|
842
|
+
Button2,
|
|
843
|
+
{
|
|
844
|
+
type: "submit",
|
|
845
|
+
form: "reset-password-form",
|
|
846
|
+
className: "w-full",
|
|
847
|
+
disabled: isLoading || resetPasswordMutation.isPending,
|
|
848
|
+
children: [
|
|
849
|
+
isLoading || resetPasswordMutation.isPending && /* @__PURE__ */ jsx5(Spinner2, {}),
|
|
850
|
+
isLoading || resetPasswordMutation.isPending ? t("form.submitting") : t("form.submit")
|
|
851
|
+
]
|
|
852
|
+
}
|
|
853
|
+
)
|
|
854
|
+
]
|
|
855
|
+
}
|
|
856
|
+
) }),
|
|
831
857
|
errorContent && /* @__PURE__ */ jsxs3(Alert2, { variant: "destructive", className: "mt-4", children: [
|
|
832
858
|
/* @__PURE__ */ jsx5(IconAlertCircle2, { className: "h-4 w-4" }),
|
|
833
859
|
/* @__PURE__ */ jsx5(AlertTitle2, { children: errorContent.title }),
|
|
@@ -845,17 +871,19 @@ import {
|
|
|
845
871
|
AlertDescription as AlertDescription3,
|
|
846
872
|
AlertTitle as AlertTitle3,
|
|
847
873
|
Button as Button3,
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
874
|
+
Form as Form3,
|
|
875
|
+
FormControl as FormControl3,
|
|
876
|
+
FormField as FormField3,
|
|
877
|
+
FormItem as FormItem3,
|
|
878
|
+
FormLabel as FormLabel3,
|
|
879
|
+
FormMessage as FormMessage3,
|
|
852
880
|
Input as Input3,
|
|
853
|
-
|
|
881
|
+
useFormField as useFormField2
|
|
854
882
|
} from "@mesob/ui/components";
|
|
855
883
|
import { useMesob as useMesob4 } from "@mesob/ui/providers";
|
|
856
884
|
import { IconAlertCircle as IconAlertCircle3, IconEye as IconEye2, IconEyeOff as IconEyeOff2 } from "@tabler/icons-react";
|
|
857
885
|
import { useEffect as useEffect3, useState as useState4 } from "react";
|
|
858
|
-
import {
|
|
886
|
+
import { useForm as useForm3 } from "react-hook-form";
|
|
859
887
|
import { toast as toast3 } from "sonner";
|
|
860
888
|
import { z as z3 } from "zod";
|
|
861
889
|
|
|
@@ -878,22 +906,55 @@ function normalizePhone(phone) {
|
|
|
878
906
|
}
|
|
879
907
|
|
|
880
908
|
// src/components/auth/sign-in.tsx
|
|
881
|
-
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
909
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
882
910
|
var isPhone = (s) => /^\+?[0-9()[\]\s-]{6,}$/.test(s);
|
|
883
|
-
|
|
911
|
+
function PasswordInput2({
|
|
912
|
+
field,
|
|
913
|
+
show,
|
|
914
|
+
onToggle,
|
|
915
|
+
placeholder
|
|
916
|
+
}) {
|
|
917
|
+
const { formItemId, error } = useFormField2();
|
|
918
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
919
|
+
/* @__PURE__ */ jsx6(
|
|
920
|
+
Input3,
|
|
921
|
+
{
|
|
922
|
+
...field,
|
|
923
|
+
id: formItemId,
|
|
924
|
+
type: show ? "text" : "password",
|
|
925
|
+
placeholder,
|
|
926
|
+
autoComplete: "current-password",
|
|
927
|
+
"aria-invalid": !!error,
|
|
928
|
+
className: "pr-10"
|
|
929
|
+
}
|
|
930
|
+
),
|
|
931
|
+
/* @__PURE__ */ jsx6(
|
|
932
|
+
Button3,
|
|
933
|
+
{
|
|
934
|
+
type: "button",
|
|
935
|
+
variant: "ghost",
|
|
936
|
+
size: "icon",
|
|
937
|
+
className: "absolute right-0 top-0 h-full px-3 text-muted-foreground hover:text-foreground",
|
|
938
|
+
onClick: onToggle,
|
|
939
|
+
"aria-label": show ? "Hide password" : "Show password",
|
|
940
|
+
children: show ? /* @__PURE__ */ jsx6(IconEyeOff2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx6(IconEye2, { className: "h-4 w-4" })
|
|
941
|
+
}
|
|
942
|
+
)
|
|
943
|
+
] });
|
|
944
|
+
}
|
|
945
|
+
var signInSchema = (t, phoneRegex) => z3.object({
|
|
884
946
|
username: z3.string().trim().min(1, { message: t("errors.requiredField") }).refine(
|
|
885
947
|
(val) => {
|
|
886
948
|
const isEmail = z3.email().safeParse(val).success;
|
|
887
949
|
const isPhone3 = phoneRegex.test(val);
|
|
888
950
|
return isEmail || isPhone3;
|
|
889
951
|
},
|
|
890
|
-
{
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
password: z3.string().min(8, t("errors.passwordLength")).max(128, t("errors.longPasswordError"))
|
|
952
|
+
{ message: t("errors.invalidEmailOrPhone") }
|
|
953
|
+
),
|
|
954
|
+
password: z3.union([
|
|
955
|
+
z3.literal(""),
|
|
956
|
+
z3.string().min(8, t("errors.passwordLength")).max(128, t("errors.longPasswordError"))
|
|
957
|
+
]).optional()
|
|
897
958
|
});
|
|
898
959
|
var SignIn = ({ redirectUrl } = {}) => {
|
|
899
960
|
const { hooks, setAuth } = useApi();
|
|
@@ -919,14 +980,9 @@ var SignIn = ({ redirectUrl } = {}) => {
|
|
|
919
980
|
}
|
|
920
981
|
});
|
|
921
982
|
const logoImage = config.ui.logoImage;
|
|
922
|
-
const
|
|
923
|
-
resolver: zodResolver3(
|
|
924
|
-
defaultValues: { username: "" },
|
|
925
|
-
mode: "onChange"
|
|
926
|
-
});
|
|
927
|
-
const passwordForm = useForm3({
|
|
928
|
-
resolver: zodResolver3(passwordSchema(t)),
|
|
929
|
-
defaultValues: { password: "" },
|
|
983
|
+
const form = useForm3({
|
|
984
|
+
resolver: zodResolver3(signInSchema(t, phoneRegex)),
|
|
985
|
+
defaultValues: { username: "", password: "" },
|
|
930
986
|
mode: "onChange"
|
|
931
987
|
});
|
|
932
988
|
useEffect3(() => {
|
|
@@ -947,6 +1003,7 @@ var SignIn = ({ redirectUrl } = {}) => {
|
|
|
947
1003
|
});
|
|
948
1004
|
if (result.exists) {
|
|
949
1005
|
setUsername(normalizedUsername);
|
|
1006
|
+
form.setValue("username", normalizedUsername);
|
|
950
1007
|
setShowPasswordField(true);
|
|
951
1008
|
} else {
|
|
952
1009
|
const email = isPhone(normalizedUsername) ? "" : normalizedUsername;
|
|
@@ -959,15 +1016,22 @@ var SignIn = ({ redirectUrl } = {}) => {
|
|
|
959
1016
|
}
|
|
960
1017
|
}
|
|
961
1018
|
} catch {
|
|
962
|
-
|
|
963
|
-
message: t("errors.checkAccountFailed")
|
|
964
|
-
});
|
|
1019
|
+
form.setError("username", { message: t("errors.checkAccountFailed") });
|
|
965
1020
|
} finally {
|
|
966
1021
|
setIsChecking(false);
|
|
967
1022
|
}
|
|
968
1023
|
};
|
|
969
|
-
const
|
|
970
|
-
|
|
1024
|
+
const onSubmit = async (values) => {
|
|
1025
|
+
if (showPasswordField) {
|
|
1026
|
+
const pwd = values.password;
|
|
1027
|
+
if (!pwd || pwd.length < 8) {
|
|
1028
|
+
form.setError("password", { message: t("errors.passwordLength") });
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
await handlePasswordSubmit({ password: pwd });
|
|
1032
|
+
} else {
|
|
1033
|
+
await handleCheckAccount(values.username);
|
|
1034
|
+
}
|
|
971
1035
|
};
|
|
972
1036
|
const handlePasswordSubmit = async (values) => {
|
|
973
1037
|
setIsLoading(true);
|
|
@@ -997,9 +1061,15 @@ var SignIn = ({ redirectUrl } = {}) => {
|
|
|
997
1061
|
const handleBack = () => {
|
|
998
1062
|
setShowPasswordField(false);
|
|
999
1063
|
setUsername("");
|
|
1000
|
-
|
|
1064
|
+
form.setValue("password", "");
|
|
1001
1065
|
};
|
|
1002
1066
|
const isSubmitting = isLoading || checkUserMutation.isPending || signInMutation.isPending || isChecking;
|
|
1067
|
+
let submitLabel = t("form.continue");
|
|
1068
|
+
if (isSubmitting) {
|
|
1069
|
+
submitLabel = showPasswordField ? t("form.submitting") : t("form.checking");
|
|
1070
|
+
} else if (showPasswordField) {
|
|
1071
|
+
submitLabel = t("form.submit");
|
|
1072
|
+
}
|
|
1003
1073
|
let errorContent = null;
|
|
1004
1074
|
if (error) {
|
|
1005
1075
|
if (typeof error === "string") {
|
|
@@ -1008,101 +1078,92 @@ var SignIn = ({ redirectUrl } = {}) => {
|
|
|
1008
1078
|
errorContent = error;
|
|
1009
1079
|
}
|
|
1010
1080
|
}
|
|
1011
|
-
const formContent =
|
|
1081
|
+
const formContent = /* @__PURE__ */ jsx6(Form3, { ...form, children: /* @__PURE__ */ jsxs4(
|
|
1012
1082
|
"form",
|
|
1013
1083
|
{
|
|
1014
1084
|
id: "sign-in-form",
|
|
1015
|
-
onSubmit:
|
|
1085
|
+
onSubmit: form.handleSubmit(onSubmit),
|
|
1086
|
+
className: "space-y-4",
|
|
1016
1087
|
children: [
|
|
1017
|
-
/* @__PURE__ */ jsxs4(
|
|
1018
|
-
/* @__PURE__ */ jsxs4(
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
|
|
1088
|
+
showPasswordField ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1089
|
+
/* @__PURE__ */ jsxs4(FormItem3, { children: [
|
|
1090
|
+
/* @__PURE__ */ jsxs4(FormLabel3, { className: "flex justify-between items-center", children: [
|
|
1091
|
+
t("form.accountLabel"),
|
|
1092
|
+
/* @__PURE__ */ jsx6(
|
|
1093
|
+
Button3,
|
|
1094
|
+
{
|
|
1095
|
+
type: "button",
|
|
1096
|
+
variant: "link",
|
|
1097
|
+
size: "sm",
|
|
1098
|
+
className: "p-0 m-0 h-auto",
|
|
1099
|
+
onClick: handleBack,
|
|
1100
|
+
children: t("changeAccount")
|
|
1101
|
+
}
|
|
1102
|
+
)
|
|
1103
|
+
] }),
|
|
1021
1104
|
/* @__PURE__ */ jsx6(
|
|
1022
|
-
|
|
1105
|
+
Input3,
|
|
1023
1106
|
{
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1107
|
+
id: "sign-in-username",
|
|
1108
|
+
type: "text",
|
|
1109
|
+
value: username,
|
|
1110
|
+
disabled: true
|
|
1028
1111
|
}
|
|
1029
1112
|
)
|
|
1030
1113
|
] }),
|
|
1031
1114
|
/* @__PURE__ */ jsx6(
|
|
1032
|
-
|
|
1115
|
+
FormField3,
|
|
1033
1116
|
{
|
|
1117
|
+
control: form.control,
|
|
1034
1118
|
name: "password",
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
/* @__PURE__ */ jsx6(
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
"aria-invalid": fieldState.invalid
|
|
1048
|
-
}
|
|
1049
|
-
),
|
|
1050
|
-
/* @__PURE__ */ jsx6(
|
|
1051
|
-
"button",
|
|
1052
|
-
{
|
|
1053
|
-
type: "button",
|
|
1054
|
-
onClick: () => setShowPassword(!showPassword),
|
|
1055
|
-
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
1056
|
-
children: showPassword ? /* @__PURE__ */ jsx6(IconEyeOff2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx6(IconEye2, { className: "h-4 w-4" })
|
|
1057
|
-
}
|
|
1058
|
-
)
|
|
1059
|
-
] }),
|
|
1060
|
-
fieldState.invalid && /* @__PURE__ */ jsx6(FieldError3, { errors: [fieldState.error] })
|
|
1119
|
+
render: ({ field }) => /* @__PURE__ */ jsxs4(FormItem3, { children: [
|
|
1120
|
+
/* @__PURE__ */ jsx6(FormLabel3, { children: t("form.passwordLabel") }),
|
|
1121
|
+
/* @__PURE__ */ jsx6(
|
|
1122
|
+
PasswordInput2,
|
|
1123
|
+
{
|
|
1124
|
+
field: { ...field, value: field.value ?? "" },
|
|
1125
|
+
show: showPassword,
|
|
1126
|
+
onToggle: () => setShowPassword(!showPassword),
|
|
1127
|
+
placeholder: t("form.passwordPlaceholder")
|
|
1128
|
+
}
|
|
1129
|
+
),
|
|
1130
|
+
/* @__PURE__ */ jsx6(FormMessage3, {})
|
|
1061
1131
|
] })
|
|
1062
1132
|
}
|
|
1063
1133
|
)
|
|
1064
|
-
] })
|
|
1065
|
-
|
|
1066
|
-
isSubmitting && /* @__PURE__ */ jsx6(Spinner3, {}),
|
|
1067
|
-
isSubmitting ? t("form.submitting") : t("form.submit")
|
|
1068
|
-
] }) })
|
|
1069
|
-
]
|
|
1070
|
-
}
|
|
1071
|
-
) : /* @__PURE__ */ jsxs4(
|
|
1072
|
-
"form",
|
|
1073
|
-
{
|
|
1074
|
-
id: "sign-in-form",
|
|
1075
|
-
onSubmit: usernameForm.handleSubmit(handleUsernameSubmit),
|
|
1076
|
-
children: [
|
|
1077
|
-
/* @__PURE__ */ jsx6(FieldGroup3, { children: /* @__PURE__ */ jsx6(
|
|
1078
|
-
Controller3,
|
|
1134
|
+
] }) : /* @__PURE__ */ jsx6(
|
|
1135
|
+
FormField3,
|
|
1079
1136
|
{
|
|
1137
|
+
control: form.control,
|
|
1080
1138
|
name: "username",
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
/* @__PURE__ */ jsx6(
|
|
1084
|
-
/* @__PURE__ */ jsx6(
|
|
1139
|
+
render: ({ field }) => /* @__PURE__ */ jsxs4(FormItem3, { children: [
|
|
1140
|
+
/* @__PURE__ */ jsx6(FormLabel3, { children: t("form.accountLabel") }),
|
|
1141
|
+
/* @__PURE__ */ jsx6(FormControl3, { children: /* @__PURE__ */ jsx6(
|
|
1085
1142
|
Input3,
|
|
1086
1143
|
{
|
|
1087
1144
|
...field,
|
|
1088
|
-
id: "sign-in-username",
|
|
1089
1145
|
type: "text",
|
|
1090
1146
|
placeholder: t("form.accountPlaceholder"),
|
|
1091
|
-
autoComplete: "username"
|
|
1092
|
-
"aria-invalid": fieldState.invalid
|
|
1147
|
+
autoComplete: "username"
|
|
1093
1148
|
}
|
|
1094
|
-
),
|
|
1095
|
-
|
|
1149
|
+
) }),
|
|
1150
|
+
/* @__PURE__ */ jsx6(FormMessage3, {})
|
|
1096
1151
|
] })
|
|
1097
1152
|
}
|
|
1098
|
-
)
|
|
1099
|
-
/* @__PURE__ */ jsx6(
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1153
|
+
),
|
|
1154
|
+
/* @__PURE__ */ jsx6(
|
|
1155
|
+
Button3,
|
|
1156
|
+
{
|
|
1157
|
+
type: "submit",
|
|
1158
|
+
className: "w-full",
|
|
1159
|
+
disabled: isSubmitting,
|
|
1160
|
+
loading: isSubmitting,
|
|
1161
|
+
children: submitLabel
|
|
1162
|
+
}
|
|
1163
|
+
)
|
|
1103
1164
|
]
|
|
1104
1165
|
}
|
|
1105
|
-
);
|
|
1166
|
+
) });
|
|
1106
1167
|
return /* @__PURE__ */ jsx6("div", { className: "space-y-4", children: /* @__PURE__ */ jsxs4(
|
|
1107
1168
|
AuthLayout,
|
|
1108
1169
|
{
|
|
@@ -1147,20 +1208,56 @@ import {
|
|
|
1147
1208
|
AlertDescription as AlertDescription4,
|
|
1148
1209
|
AlertTitle as AlertTitle4,
|
|
1149
1210
|
Button as Button4,
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1211
|
+
Form as Form4,
|
|
1212
|
+
FormControl as FormControl4,
|
|
1213
|
+
FormField as FormField4,
|
|
1214
|
+
FormItem as FormItem4,
|
|
1215
|
+
FormLabel as FormLabel4,
|
|
1216
|
+
FormMessage as FormMessage4,
|
|
1217
|
+
Input as Input4,
|
|
1218
|
+
useFormField as useFormField3
|
|
1155
1219
|
} from "@mesob/ui/components";
|
|
1156
1220
|
import { useMesob as useMesob5 } from "@mesob/ui/providers";
|
|
1157
1221
|
import { IconAlertCircle as IconAlertCircle4, IconEye as IconEye3, IconEyeOff as IconEyeOff3 } from "@tabler/icons-react";
|
|
1158
1222
|
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
1159
|
-
import {
|
|
1223
|
+
import { useForm as useForm4 } from "react-hook-form";
|
|
1160
1224
|
import { toast as toast4 } from "sonner";
|
|
1161
1225
|
import { z as z4 } from "zod";
|
|
1162
1226
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1163
1227
|
var isPhone2 = (s) => /^\+?[0-9()[\]\s-]{6,}$/.test(s);
|
|
1228
|
+
function PasswordInput3({
|
|
1229
|
+
field,
|
|
1230
|
+
show,
|
|
1231
|
+
onToggle,
|
|
1232
|
+
placeholder
|
|
1233
|
+
}) {
|
|
1234
|
+
const { formItemId, error } = useFormField3();
|
|
1235
|
+
return /* @__PURE__ */ jsxs5("div", { className: "relative", children: [
|
|
1236
|
+
/* @__PURE__ */ jsx7(
|
|
1237
|
+
Input4,
|
|
1238
|
+
{
|
|
1239
|
+
...field,
|
|
1240
|
+
id: formItemId,
|
|
1241
|
+
type: show ? "text" : "password",
|
|
1242
|
+
placeholder,
|
|
1243
|
+
"aria-invalid": !!error,
|
|
1244
|
+
className: "pr-10"
|
|
1245
|
+
}
|
|
1246
|
+
),
|
|
1247
|
+
/* @__PURE__ */ jsx7(
|
|
1248
|
+
Button4,
|
|
1249
|
+
{
|
|
1250
|
+
type: "button",
|
|
1251
|
+
variant: "ghost",
|
|
1252
|
+
size: "icon",
|
|
1253
|
+
className: "absolute right-0 top-0 h-full px-3 text-muted-foreground hover:text-foreground",
|
|
1254
|
+
onClick: onToggle,
|
|
1255
|
+
"aria-label": show ? "Hide password" : "Show password",
|
|
1256
|
+
children: show ? /* @__PURE__ */ jsx7(IconEyeOff3, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx7(IconEye3, { className: "h-4 w-4" })
|
|
1257
|
+
}
|
|
1258
|
+
)
|
|
1259
|
+
] });
|
|
1260
|
+
}
|
|
1164
1261
|
var signUpSchema = (t) => z4.object({
|
|
1165
1262
|
fullName: z4.string().min(1, t("errors.fullNameRequired")),
|
|
1166
1263
|
identifier: z4.string().min(1, t("errors.contactRequired")).refine(
|
|
@@ -1306,123 +1403,92 @@ var SignUp = ({
|
|
|
1306
1403
|
)
|
|
1307
1404
|
] }),
|
|
1308
1405
|
children: [
|
|
1309
|
-
/* @__PURE__ */ jsxs5("form", { id: "sign-up-form", onSubmit: handleSubmit, children: [
|
|
1310
|
-
/* @__PURE__ */
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
{
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
)
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
name: "confirmPassword",
|
|
1396
|
-
control: form.control,
|
|
1397
|
-
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs5(Field4, { "data-invalid": fieldState.invalid, children: [
|
|
1398
|
-
/* @__PURE__ */ jsx7(FieldLabel4, { htmlFor: "sign-up-confirmPassword", children: t("form.confirmPasswordLabel") }),
|
|
1399
|
-
/* @__PURE__ */ jsxs5("div", { className: "relative", children: [
|
|
1400
|
-
/* @__PURE__ */ jsx7(
|
|
1401
|
-
Input4,
|
|
1402
|
-
{
|
|
1403
|
-
...field,
|
|
1404
|
-
id: "sign-up-confirmPassword",
|
|
1405
|
-
type: showConfirmPassword ? "text" : "password",
|
|
1406
|
-
placeholder: t("form.passwordPlaceholder"),
|
|
1407
|
-
"aria-invalid": fieldState.invalid
|
|
1408
|
-
}
|
|
1409
|
-
),
|
|
1410
|
-
/* @__PURE__ */ jsx7(
|
|
1411
|
-
"button",
|
|
1412
|
-
{
|
|
1413
|
-
type: "button",
|
|
1414
|
-
onClick: () => setShowConfirmPassword(!showConfirmPassword),
|
|
1415
|
-
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
1416
|
-
children: showConfirmPassword ? /* @__PURE__ */ jsx7(IconEyeOff3, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx7(IconEye3, { className: "h-4 w-4" })
|
|
1417
|
-
}
|
|
1418
|
-
)
|
|
1419
|
-
] }),
|
|
1420
|
-
fieldState.invalid && /* @__PURE__ */ jsx7(FieldError4, { errors: [fieldState.error] })
|
|
1421
|
-
] })
|
|
1422
|
-
}
|
|
1423
|
-
)
|
|
1424
|
-
] }),
|
|
1425
|
-
/* @__PURE__ */ jsx7("div", { className: "mt-4", children: /* @__PURE__ */ jsx7(
|
|
1406
|
+
/* @__PURE__ */ jsx7(Form4, { ...form, children: /* @__PURE__ */ jsxs5("form", { id: "sign-up-form", onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
1407
|
+
/* @__PURE__ */ jsx7(
|
|
1408
|
+
FormField4,
|
|
1409
|
+
{
|
|
1410
|
+
control: form.control,
|
|
1411
|
+
name: "fullName",
|
|
1412
|
+
render: ({ field }) => /* @__PURE__ */ jsxs5(FormItem4, { children: [
|
|
1413
|
+
/* @__PURE__ */ jsx7(FormLabel4, { children: t("form.fullNameLabel") }),
|
|
1414
|
+
/* @__PURE__ */ jsx7(FormControl4, { children: /* @__PURE__ */ jsx7(
|
|
1415
|
+
Input4,
|
|
1416
|
+
{
|
|
1417
|
+
...field,
|
|
1418
|
+
placeholder: t("form.fullNamePlaceholder")
|
|
1419
|
+
}
|
|
1420
|
+
) }),
|
|
1421
|
+
/* @__PURE__ */ jsx7(FormMessage4, {})
|
|
1422
|
+
] })
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
/* @__PURE__ */ jsx7(
|
|
1426
|
+
FormField4,
|
|
1427
|
+
{
|
|
1428
|
+
control: form.control,
|
|
1429
|
+
name: "identifier",
|
|
1430
|
+
render: ({ field }) => /* @__PURE__ */ jsxs5(FormItem4, { children: [
|
|
1431
|
+
/* @__PURE__ */ jsx7(
|
|
1432
|
+
FormLabel4,
|
|
1433
|
+
{
|
|
1434
|
+
className: hasInitialIdentifier ? "block" : void 0,
|
|
1435
|
+
children: identifierLabel
|
|
1436
|
+
}
|
|
1437
|
+
),
|
|
1438
|
+
/* @__PURE__ */ jsx7(FormControl4, { children: /* @__PURE__ */ jsx7(
|
|
1439
|
+
Input4,
|
|
1440
|
+
{
|
|
1441
|
+
...field,
|
|
1442
|
+
type: field.value.includes("@") ? "email" : "tel",
|
|
1443
|
+
placeholder: hasInitialIdentifier ? void 0 : t("form.accountPlaceholder") || "Email or phone number",
|
|
1444
|
+
disabled: hasInitialIdentifier
|
|
1445
|
+
}
|
|
1446
|
+
) }),
|
|
1447
|
+
/* @__PURE__ */ jsx7(FormMessage4, {})
|
|
1448
|
+
] })
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1451
|
+
/* @__PURE__ */ jsx7(
|
|
1452
|
+
FormField4,
|
|
1453
|
+
{
|
|
1454
|
+
control: form.control,
|
|
1455
|
+
name: "password",
|
|
1456
|
+
render: ({ field }) => /* @__PURE__ */ jsxs5(FormItem4, { children: [
|
|
1457
|
+
/* @__PURE__ */ jsx7(FormLabel4, { children: t("form.passwordLabel") }),
|
|
1458
|
+
/* @__PURE__ */ jsx7(
|
|
1459
|
+
PasswordInput3,
|
|
1460
|
+
{
|
|
1461
|
+
field,
|
|
1462
|
+
show: showPassword,
|
|
1463
|
+
onToggle: () => setShowPassword(!showPassword),
|
|
1464
|
+
placeholder: t("form.passwordPlaceholder")
|
|
1465
|
+
}
|
|
1466
|
+
),
|
|
1467
|
+
/* @__PURE__ */ jsx7(FormMessage4, {})
|
|
1468
|
+
] })
|
|
1469
|
+
}
|
|
1470
|
+
),
|
|
1471
|
+
/* @__PURE__ */ jsx7(
|
|
1472
|
+
FormField4,
|
|
1473
|
+
{
|
|
1474
|
+
control: form.control,
|
|
1475
|
+
name: "confirmPassword",
|
|
1476
|
+
render: ({ field }) => /* @__PURE__ */ jsxs5(FormItem4, { children: [
|
|
1477
|
+
/* @__PURE__ */ jsx7(FormLabel4, { children: t("form.confirmPasswordLabel") }),
|
|
1478
|
+
/* @__PURE__ */ jsx7(
|
|
1479
|
+
PasswordInput3,
|
|
1480
|
+
{
|
|
1481
|
+
field,
|
|
1482
|
+
show: showConfirmPassword,
|
|
1483
|
+
onToggle: () => setShowConfirmPassword(!showConfirmPassword),
|
|
1484
|
+
placeholder: t("form.passwordPlaceholder")
|
|
1485
|
+
}
|
|
1486
|
+
),
|
|
1487
|
+
/* @__PURE__ */ jsx7(FormMessage4, {})
|
|
1488
|
+
] })
|
|
1489
|
+
}
|
|
1490
|
+
),
|
|
1491
|
+
/* @__PURE__ */ jsx7(
|
|
1426
1492
|
Button4,
|
|
1427
1493
|
{
|
|
1428
1494
|
type: "submit",
|
|
@@ -1431,8 +1497,8 @@ var SignUp = ({
|
|
|
1431
1497
|
disabled: isLoading || signUpMutation.isPending,
|
|
1432
1498
|
children: isLoading || signUpMutation.isPending ? t("form.submitting") : t("form.submit")
|
|
1433
1499
|
}
|
|
1434
|
-
)
|
|
1435
|
-
] }),
|
|
1500
|
+
)
|
|
1501
|
+
] }) }),
|
|
1436
1502
|
errorContent && /* @__PURE__ */ jsxs5(Alert4, { variant: "destructive", className: "mt-4", children: [
|
|
1437
1503
|
/* @__PURE__ */ jsx7(IconAlertCircle4, { className: "h-4 w-4" }),
|
|
1438
1504
|
/* @__PURE__ */ jsx7(AlertTitle4, { children: errorContent.title }),
|
|
@@ -1447,19 +1513,22 @@ var SignUp = ({
|
|
|
1447
1513
|
import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
|
|
1448
1514
|
import {
|
|
1449
1515
|
Button as Button6,
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1516
|
+
Form as Form5,
|
|
1517
|
+
FormControl as FormControl5,
|
|
1518
|
+
FormField as FormField5,
|
|
1519
|
+
FormItem as FormItem5,
|
|
1520
|
+
FormLabel as FormLabel5,
|
|
1521
|
+
FormMessage as FormMessage5,
|
|
1453
1522
|
InputOTP as InputOTP2,
|
|
1454
1523
|
InputOTPGroup as InputOTPGroup2,
|
|
1455
1524
|
InputOTPSlot as InputOTPSlot2,
|
|
1456
|
-
Spinner as
|
|
1525
|
+
Spinner as Spinner4
|
|
1457
1526
|
} from "@mesob/ui/components";
|
|
1458
|
-
import {
|
|
1527
|
+
import { useForm as useForm5 } from "react-hook-form";
|
|
1459
1528
|
import { z as z5 } from "zod";
|
|
1460
1529
|
|
|
1461
1530
|
// src/components/auth/countdown.tsx
|
|
1462
|
-
import { Button as Button5, Spinner as
|
|
1531
|
+
import { Button as Button5, Spinner as Spinner3 } from "@mesob/ui/components";
|
|
1463
1532
|
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
1464
1533
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1465
1534
|
var Countdown = ({
|
|
@@ -1505,7 +1574,7 @@ var Countdown = ({
|
|
|
1505
1574
|
onClick: handleResend,
|
|
1506
1575
|
disabled: isResending || resending,
|
|
1507
1576
|
children: [
|
|
1508
|
-
isResending || resending && /* @__PURE__ */ jsx8(
|
|
1577
|
+
isResending || resending && /* @__PURE__ */ jsx8(Spinner3, {}),
|
|
1509
1578
|
t("resend")
|
|
1510
1579
|
]
|
|
1511
1580
|
}
|
|
@@ -1532,54 +1601,61 @@ var VerificationForm = ({
|
|
|
1532
1601
|
const handleSubmit = form.handleSubmit(async (values) => {
|
|
1533
1602
|
await onSubmit(values);
|
|
1534
1603
|
});
|
|
1535
|
-
return /* @__PURE__ */
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1604
|
+
return /* @__PURE__ */ jsx9(Form5, { ...form, children: /* @__PURE__ */ jsxs7(
|
|
1605
|
+
"form",
|
|
1606
|
+
{
|
|
1607
|
+
id: "verification-form",
|
|
1608
|
+
onSubmit: handleSubmit,
|
|
1609
|
+
className: "space-y-4",
|
|
1610
|
+
children: [
|
|
1611
|
+
/* @__PURE__ */ jsx9(
|
|
1612
|
+
FormField5,
|
|
1613
|
+
{
|
|
1614
|
+
control: form.control,
|
|
1615
|
+
name: "code",
|
|
1616
|
+
render: ({ field }) => /* @__PURE__ */ jsxs7(FormItem5, { children: [
|
|
1617
|
+
/* @__PURE__ */ jsx9("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx9(FormLabel5, { children: t("form.codeLabel") }) }),
|
|
1618
|
+
/* @__PURE__ */ jsx9(FormControl5, { children: /* @__PURE__ */ jsx9(
|
|
1619
|
+
InputOTP2,
|
|
1620
|
+
{
|
|
1621
|
+
maxLength: 6,
|
|
1622
|
+
required: true,
|
|
1623
|
+
value: field.value ?? "",
|
|
1624
|
+
onChange: field.onChange,
|
|
1625
|
+
onBlur: field.onBlur,
|
|
1626
|
+
containerClassName: "gap-4 justify-center mb-2 flex items-center",
|
|
1627
|
+
children: /* @__PURE__ */ jsxs7(InputOTPGroup2, { className: "gap-3 *:data-[slot=input-otp-slot]:h-12 *:data-[slot=input-otp-slot]:w-12 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:text-xl", children: [
|
|
1628
|
+
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 0 }),
|
|
1629
|
+
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 1 }),
|
|
1630
|
+
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 2 }),
|
|
1631
|
+
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 3 }),
|
|
1632
|
+
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 4 }),
|
|
1633
|
+
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 5 })
|
|
1634
|
+
] })
|
|
1635
|
+
}
|
|
1636
|
+
) }),
|
|
1637
|
+
/* @__PURE__ */ jsx9(FormMessage5, {})
|
|
1638
|
+
] })
|
|
1639
|
+
}
|
|
1640
|
+
),
|
|
1641
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex justify-between items-center", children: [
|
|
1642
|
+
/* @__PURE__ */ jsx9(Countdown, { onResend, resending: isLoading }),
|
|
1643
|
+
/* @__PURE__ */ jsxs7(
|
|
1644
|
+
Button6,
|
|
1544
1645
|
{
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
"aria-invalid": fieldState.invalid,
|
|
1553
|
-
children: /* @__PURE__ */ jsxs7(InputOTPGroup2, { className: "gap-3 *:data-[slot=input-otp-slot]:h-12 *:data-[slot=input-otp-slot]:w-12 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:text-xl", children: [
|
|
1554
|
-
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 0 }),
|
|
1555
|
-
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 1 }),
|
|
1556
|
-
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 2 }),
|
|
1557
|
-
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 3 }),
|
|
1558
|
-
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 4 }),
|
|
1559
|
-
/* @__PURE__ */ jsx9(InputOTPSlot2, { className: "h-12", index: 5 })
|
|
1560
|
-
] })
|
|
1646
|
+
type: "submit",
|
|
1647
|
+
form: "verification-form",
|
|
1648
|
+
disabled: isLoading || form.watch("code").length !== 6,
|
|
1649
|
+
children: [
|
|
1650
|
+
isLoading && /* @__PURE__ */ jsx9(Spinner4, {}),
|
|
1651
|
+
t("form.confirm")
|
|
1652
|
+
]
|
|
1561
1653
|
}
|
|
1562
|
-
)
|
|
1563
|
-
fieldState.invalid && /* @__PURE__ */ jsx9(FieldError5, { errors: [fieldState.error] })
|
|
1654
|
+
)
|
|
1564
1655
|
] })
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
/* @__PURE__ */ jsx9(Countdown, { onResend, resending: isLoading }),
|
|
1569
|
-
/* @__PURE__ */ jsxs7(
|
|
1570
|
-
Button6,
|
|
1571
|
-
{
|
|
1572
|
-
type: "submit",
|
|
1573
|
-
form: "verification-form",
|
|
1574
|
-
disabled: isLoading || form.watch("code").length !== 6,
|
|
1575
|
-
children: [
|
|
1576
|
-
isLoading && /* @__PURE__ */ jsx9(Spinner5, {}),
|
|
1577
|
-
t("form.confirm")
|
|
1578
|
-
]
|
|
1579
|
-
}
|
|
1580
|
-
)
|
|
1581
|
-
] })
|
|
1582
|
-
] });
|
|
1656
|
+
]
|
|
1657
|
+
}
|
|
1658
|
+
) });
|
|
1583
1659
|
};
|
|
1584
1660
|
|
|
1585
1661
|
// src/components/auth/verify-email.tsx
|
|
@@ -2541,7 +2617,7 @@ import { useState as useState16 } from "react";
|
|
|
2541
2617
|
|
|
2542
2618
|
// src/components/profile/request-change-email-form.tsx
|
|
2543
2619
|
import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
|
|
2544
|
-
import { Button as Button13, Input as Input5, Label, Spinner as
|
|
2620
|
+
import { Button as Button13, Input as Input5, Label, Spinner as Spinner5 } from "@mesob/ui/components";
|
|
2545
2621
|
import { IconEye as IconEye4, IconEyeOff as IconEyeOff4 } from "@tabler/icons-react";
|
|
2546
2622
|
import { useEffect as useEffect8, useState as useState14 } from "react";
|
|
2547
2623
|
import { useForm as useForm6 } from "react-hook-form";
|
|
@@ -2776,7 +2852,7 @@ function RequestChangeEmailForm({
|
|
|
2776
2852
|
}
|
|
2777
2853
|
),
|
|
2778
2854
|
/* @__PURE__ */ jsxs19(Button13, { type: "submit", disabled: isLoading, children: [
|
|
2779
|
-
isLoading && /* @__PURE__ */ jsx21(
|
|
2855
|
+
isLoading && /* @__PURE__ */ jsx21(Spinner5, { className: "mr-2 h-4 w-4" }),
|
|
2780
2856
|
isChecking ? "Checking\u2026" : buttonText
|
|
2781
2857
|
] })
|
|
2782
2858
|
] })
|
|
@@ -3042,7 +3118,7 @@ import {
|
|
|
3042
3118
|
CollapsibleTrigger as CollapsibleTrigger2,
|
|
3043
3119
|
Input as Input6,
|
|
3044
3120
|
Label as Label2,
|
|
3045
|
-
Spinner as
|
|
3121
|
+
Spinner as Spinner6
|
|
3046
3122
|
} from "@mesob/ui/components";
|
|
3047
3123
|
import { IconChevronDown as IconChevronDown2, IconEye as IconEye5, IconEyeOff as IconEyeOff5 } from "@tabler/icons-react";
|
|
3048
3124
|
import { useState as useState17 } from "react";
|
|
@@ -3254,7 +3330,7 @@ function ChangePasswordForm() {
|
|
|
3254
3330
|
}
|
|
3255
3331
|
),
|
|
3256
3332
|
/* @__PURE__ */ jsxs22(Button15, { type: "submit", disabled: isSubmitting, children: [
|
|
3257
|
-
isSubmitting && /* @__PURE__ */ jsx25(
|
|
3333
|
+
isSubmitting && /* @__PURE__ */ jsx25(Spinner6, { className: "mr-2 h-4 w-4" }),
|
|
3258
3334
|
"Change Password"
|
|
3259
3335
|
] })
|
|
3260
3336
|
] })
|
|
@@ -3276,7 +3352,7 @@ import { useState as useState20 } from "react";
|
|
|
3276
3352
|
|
|
3277
3353
|
// src/components/profile/request-change-phone-form.tsx
|
|
3278
3354
|
import { zodResolver as zodResolver8 } from "@hookform/resolvers/zod";
|
|
3279
|
-
import { Button as Button16, Input as Input7, Label as Label3, Spinner as
|
|
3355
|
+
import { Button as Button16, Input as Input7, Label as Label3, Spinner as Spinner7 } from "@mesob/ui/components";
|
|
3280
3356
|
import { IconEye as IconEye6, IconEyeOff as IconEyeOff6 } from "@tabler/icons-react";
|
|
3281
3357
|
import { useEffect as useEffect9, useState as useState18 } from "react";
|
|
3282
3358
|
import { useForm as useForm8 } from "react-hook-form";
|
|
@@ -3524,7 +3600,7 @@ function RequestChangePhoneForm({
|
|
|
3524
3600
|
}
|
|
3525
3601
|
),
|
|
3526
3602
|
/* @__PURE__ */ jsxs23(Button16, { type: "submit", disabled: isLoading, children: [
|
|
3527
|
-
isLoading && /* @__PURE__ */ jsx26(
|
|
3603
|
+
isLoading && /* @__PURE__ */ jsx26(Spinner7, { className: "mr-2 h-4 w-4" }),
|
|
3528
3604
|
isChecking ? "Checking\u2026" : buttonText
|
|
3529
3605
|
] })
|
|
3530
3606
|
] })
|