@insforge/react 0.4.7 → 0.4.9
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 +55 -95
- package/dist/atoms.cjs +81 -93
- package/dist/atoms.cjs.map +1 -1
- package/dist/atoms.d.cts +4 -4
- package/dist/atoms.d.ts +4 -4
- package/dist/atoms.js +81 -93
- package/dist/atoms.js.map +1 -1
- package/dist/components.cjs +128 -130
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +128 -130
- package/dist/components.js.map +1 -1
- package/dist/forms.cjs +108 -124
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.d.cts +2 -4
- package/dist/forms.d.ts +2 -4
- package/dist/forms.js +108 -124
- package/dist/forms.js.map +1 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +148 -155
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.js +148 -155
- package/dist/index.js.map +1 -1
- package/dist/router.cjs +11 -21
- package/dist/router.cjs.map +1 -1
- package/dist/router.d.cts +5 -4
- package/dist/router.d.ts +5 -4
- package/dist/router.js +11 -21
- package/dist/router.js.map +1 -1
- package/dist/styles.css +43 -71
- package/package.json +1 -1
package/dist/components.js
CHANGED
|
@@ -134,34 +134,27 @@ function AuthPasswordStrengthIndicator({
|
|
|
134
134
|
config
|
|
135
135
|
}) {
|
|
136
136
|
const requirements = createRequirements(config);
|
|
137
|
-
return /* @__PURE__ */ jsx("div", { className: "if-passwordStrength if-internal-ps6w3k", children: /* @__PURE__ */ jsx("div", { className: "if-passwordStrength-requirements", children: requirements.map((req) => /* @__PURE__ */ jsxs(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
"
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
),
|
|
160
|
-
/* @__PURE__ */ jsx("span", { children: req.label })
|
|
161
|
-
]
|
|
162
|
-
},
|
|
163
|
-
req.label
|
|
164
|
-
)) }) });
|
|
137
|
+
return /* @__PURE__ */ jsx("div", { className: "if-passwordStrength if-internal-ps6w3k", children: /* @__PURE__ */ jsx("div", { className: "if-passwordStrength-requirements", children: requirements.map((req) => /* @__PURE__ */ jsxs("div", { className: "if-passwordStrength-requirement", children: [
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
style: {
|
|
142
|
+
display: "flex",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
justifyContent: "center",
|
|
145
|
+
width: "1rem",
|
|
146
|
+
height: "1rem",
|
|
147
|
+
borderRadius: "50%",
|
|
148
|
+
border: "2px solid",
|
|
149
|
+
borderColor: req.test(password) ? "transparent" : "#9ca3af",
|
|
150
|
+
backgroundColor: req.test(password) ? "#059669" : "white",
|
|
151
|
+
transition: "all 0.2s"
|
|
152
|
+
},
|
|
153
|
+
children: req.test(password) && /* @__PURE__ */ jsx(Check, { style: { width: "0.75rem", height: "0.75rem", color: "white" } })
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
/* @__PURE__ */ jsx("span", { children: req.label })
|
|
157
|
+
] }, req.label)) }) });
|
|
165
158
|
}
|
|
166
159
|
function createRequirements(config) {
|
|
167
160
|
const requirements = [];
|
|
@@ -229,11 +222,12 @@ function AuthPasswordField({
|
|
|
229
222
|
onFocus,
|
|
230
223
|
...props
|
|
231
224
|
}) {
|
|
225
|
+
const [searchParams] = useSearchParams();
|
|
232
226
|
const [showPassword, setShowPassword] = useState(false);
|
|
233
227
|
const [showStrength, setShowStrength] = useState(false);
|
|
234
228
|
const resolvedForgotPasswordHref = useMemo(
|
|
235
|
-
() => forgotPasswordLink ?
|
|
236
|
-
[forgotPasswordLink]
|
|
229
|
+
() => forgotPasswordLink ? resolveAuthUrl(forgotPasswordLink.href, searchParams) : void 0,
|
|
230
|
+
[forgotPasswordLink, searchParams]
|
|
237
231
|
);
|
|
238
232
|
const handleFocus = (e) => {
|
|
239
233
|
if (showStrengthIndicator) {
|
|
@@ -571,7 +565,6 @@ function AuthOAuthProviders({
|
|
|
571
565
|
function AuthVerificationCodeInput({
|
|
572
566
|
length = 6,
|
|
573
567
|
value,
|
|
574
|
-
email,
|
|
575
568
|
onChange,
|
|
576
569
|
disabled = false,
|
|
577
570
|
onComplete
|
|
@@ -619,58 +612,42 @@ function AuthVerificationCodeInput({
|
|
|
619
612
|
}
|
|
620
613
|
}
|
|
621
614
|
};
|
|
622
|
-
return /* @__PURE__ */
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
". Enter it below to proceed."
|
|
628
|
-
] }),
|
|
629
|
-
/* @__PURE__ */ jsx("div", { className: "if-verificationCode-inputContainer", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsx(
|
|
630
|
-
"input",
|
|
631
|
-
{
|
|
632
|
-
ref: (el) => {
|
|
633
|
-
inputRefs.current[index] = el;
|
|
634
|
-
},
|
|
635
|
-
type: "text",
|
|
636
|
-
inputMode: "numeric",
|
|
637
|
-
maxLength: 1,
|
|
638
|
-
value: value[index] || "",
|
|
639
|
-
onChange: (e) => handleChange(index, e.target.value),
|
|
640
|
-
onKeyDown: (e) => handleKeyDown(index, e),
|
|
641
|
-
onPaste: handlePaste,
|
|
642
|
-
disabled,
|
|
643
|
-
className: "if-verificationCode-input",
|
|
644
|
-
autoComplete: "one-time-code"
|
|
615
|
+
return /* @__PURE__ */ jsx("div", { className: "if-verificationCode-inputContainer", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsx(
|
|
616
|
+
"input",
|
|
617
|
+
{
|
|
618
|
+
ref: (el) => {
|
|
619
|
+
inputRefs.current[index] = el;
|
|
645
620
|
},
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
621
|
+
type: "text",
|
|
622
|
+
inputMode: "numeric",
|
|
623
|
+
maxLength: 1,
|
|
624
|
+
value: value[index] || "",
|
|
625
|
+
onChange: (e) => handleChange(index, e.target.value),
|
|
626
|
+
onKeyDown: (e) => handleKeyDown(index, e),
|
|
627
|
+
onPaste: handlePaste,
|
|
628
|
+
disabled,
|
|
629
|
+
className: "if-verificationCode-input",
|
|
630
|
+
autoComplete: "one-time-code"
|
|
631
|
+
},
|
|
632
|
+
index
|
|
633
|
+
)) });
|
|
649
634
|
}
|
|
650
635
|
function AuthEmailVerificationStep({
|
|
651
636
|
email,
|
|
652
|
-
method
|
|
653
|
-
onVerifyCode
|
|
637
|
+
method,
|
|
638
|
+
onVerifyCode,
|
|
639
|
+
emailSent = false
|
|
654
640
|
}) {
|
|
655
641
|
const { sendVerificationEmail } = useInsforge();
|
|
656
642
|
const [resendDisabled, setResendDisabled] = useState(true);
|
|
657
|
-
const [resendCountdown, setResendCountdown] = useState(60);
|
|
643
|
+
const [resendCountdown, setResendCountdown] = useState(emailSent ? 60 : 0);
|
|
658
644
|
const [isSending, setIsSending] = useState(false);
|
|
659
645
|
const [verificationCode, setVerificationCode] = useState("");
|
|
660
646
|
const [isVerifying, setIsVerifying] = useState(false);
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
const sendInitialEmail = async () => {
|
|
664
|
-
try {
|
|
665
|
-
await sendVerificationEmail(email);
|
|
666
|
-
} catch (error) {
|
|
667
|
-
console.error("Failed to send verification email:", error);
|
|
668
|
-
}
|
|
669
|
-
};
|
|
670
|
-
void sendInitialEmail();
|
|
671
|
-
}, [email, sendVerificationEmail]);
|
|
647
|
+
const isLinkMethod = method === "link";
|
|
648
|
+
const displayDescription = isLinkMethod ? "We've sent an email to {email}. Please check your email to confirm your account before signing in. The confirmation link expires in 10 minutes." : "We've sent a verification code to your inbox at {email}. Enter it below to proceed.";
|
|
672
649
|
useEffect(() => {
|
|
673
|
-
if (resendCountdown > 0) {
|
|
650
|
+
if (emailSent && resendCountdown > 0) {
|
|
674
651
|
const timer = setInterval(() => {
|
|
675
652
|
setResendCountdown((prev) => {
|
|
676
653
|
if (prev <= 1) {
|
|
@@ -682,7 +659,7 @@ function AuthEmailVerificationStep({
|
|
|
682
659
|
}, 1e3);
|
|
683
660
|
return () => clearInterval(timer);
|
|
684
661
|
}
|
|
685
|
-
}, [resendCountdown]);
|
|
662
|
+
}, [emailSent, resendCountdown]);
|
|
686
663
|
const handleResend = async () => {
|
|
687
664
|
setResendDisabled(true);
|
|
688
665
|
setResendCountdown(60);
|
|
@@ -708,23 +685,29 @@ function AuthEmailVerificationStep({
|
|
|
708
685
|
setVerificationCode("");
|
|
709
686
|
}
|
|
710
687
|
};
|
|
711
|
-
const displayDescription = defaultDescription;
|
|
712
|
-
const isLinkMethod = method === "link";
|
|
713
688
|
return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
|
|
714
|
-
/* @__PURE__ */
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
689
|
+
isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-descriptionContainer", children: [
|
|
690
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-descriptionTitle", children: "Verify Your Email" }),
|
|
691
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
|
|
692
|
+
part,
|
|
693
|
+
index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationLink-email", children: email })
|
|
694
|
+
] }, index)) })
|
|
695
|
+
] }),
|
|
718
696
|
!isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
697
|
+
/* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeInputWrapper", children: [
|
|
698
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-codeDescription", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
|
|
699
|
+
part,
|
|
700
|
+
index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationCode-email", children: email })
|
|
701
|
+
] }, index)) }),
|
|
702
|
+
/* @__PURE__ */ jsx(
|
|
703
|
+
AuthVerificationCodeInput,
|
|
704
|
+
{
|
|
705
|
+
value: verificationCode,
|
|
706
|
+
onChange: setVerificationCode,
|
|
707
|
+
disabled: isVerifying
|
|
708
|
+
}
|
|
709
|
+
)
|
|
710
|
+
] }),
|
|
728
711
|
/* @__PURE__ */ jsx(
|
|
729
712
|
AuthSubmitButton,
|
|
730
713
|
{
|
|
@@ -734,7 +717,7 @@ function AuthEmailVerificationStep({
|
|
|
734
717
|
onClick: () => {
|
|
735
718
|
void handleSubmit();
|
|
736
719
|
},
|
|
737
|
-
children: isVerifying ? "Verifying..." : "
|
|
720
|
+
children: isVerifying ? "Verifying..." : "Continue"
|
|
738
721
|
}
|
|
739
722
|
)
|
|
740
723
|
] }),
|
|
@@ -766,6 +749,8 @@ function AuthResetPasswordVerificationStep({
|
|
|
766
749
|
const [isSending, setIsSending] = useState(false);
|
|
767
750
|
const [verificationCode, setVerificationCode] = useState("");
|
|
768
751
|
const [isVerifying, setIsVerifying] = useState(false);
|
|
752
|
+
const isLinkMethod = method === "link";
|
|
753
|
+
const displayDescription = isLinkMethod ? "We have sent an email to {email}. Please check your email to reset your password. The link expires in 10 minutes." : "We've sent a reset password code to your inbox at {email}. Enter it below to proceed.";
|
|
769
754
|
useEffect(() => {
|
|
770
755
|
if (resendCountdown > 0) {
|
|
771
756
|
const timer = setInterval(() => {
|
|
@@ -805,17 +790,20 @@ function AuthResetPasswordVerificationStep({
|
|
|
805
790
|
setVerificationCode("");
|
|
806
791
|
}
|
|
807
792
|
};
|
|
808
|
-
const isLinkMethod = method === "link";
|
|
809
|
-
const description = isLinkMethod ? `We've sent a password reset link to ${email}. Please check your email and click the link to reset your password. The link will expire in 10 minutes.` : `We've sent a 6-digit verification code to ${email}. Please enter it below to reset your password. The code will expire in 10 minutes.`;
|
|
810
793
|
return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
|
|
811
|
-
/* @__PURE__ */
|
|
794
|
+
isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-descriptionContainer", children: [
|
|
795
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-descriptionTitle", children: "Check Your Email" }),
|
|
796
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
|
|
797
|
+
part,
|
|
798
|
+
index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationLink-email", children: email })
|
|
799
|
+
] }, index)) })
|
|
800
|
+
] }),
|
|
812
801
|
!isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
|
|
813
802
|
/* @__PURE__ */ jsx("div", { className: "if-verificationStep-codeInputWrapper", children: /* @__PURE__ */ jsx(
|
|
814
803
|
AuthVerificationCodeInput,
|
|
815
804
|
{
|
|
816
805
|
value: verificationCode,
|
|
817
806
|
onChange: setVerificationCode,
|
|
818
|
-
email,
|
|
819
807
|
disabled: isVerifying
|
|
820
808
|
}
|
|
821
809
|
) }),
|
|
@@ -858,7 +846,6 @@ function SignInForm({
|
|
|
858
846
|
error,
|
|
859
847
|
loading = false,
|
|
860
848
|
oauthLoading = null,
|
|
861
|
-
availableProviders = [],
|
|
862
849
|
onOAuthClick,
|
|
863
850
|
authConfig,
|
|
864
851
|
title = "Welcome Back",
|
|
@@ -868,7 +855,7 @@ function SignInForm({
|
|
|
868
855
|
passwordLabel = "Password",
|
|
869
856
|
passwordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
870
857
|
forgotPasswordText = "Forget Password?",
|
|
871
|
-
forgotPasswordUrl,
|
|
858
|
+
forgotPasswordUrl = "/forgot-password",
|
|
872
859
|
submitButtonText = "Sign In",
|
|
873
860
|
loadingButtonText = "Signing in...",
|
|
874
861
|
signUpText = "Don't have an account?",
|
|
@@ -879,15 +866,17 @@ function SignInForm({
|
|
|
879
866
|
onVerifyCode
|
|
880
867
|
}) {
|
|
881
868
|
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
882
|
-
/* @__PURE__ */ jsx(
|
|
883
|
-
|
|
869
|
+
/* @__PURE__ */ jsx(AuthHeader, { title, subtitle }),
|
|
870
|
+
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
871
|
+
showVerificationStep ? /* @__PURE__ */ jsx(
|
|
872
|
+
AuthEmailVerificationStep,
|
|
884
873
|
{
|
|
885
|
-
|
|
886
|
-
|
|
874
|
+
email,
|
|
875
|
+
method: authConfig.verifyEmailMethod,
|
|
876
|
+
onVerifyCode,
|
|
877
|
+
emailSent: false
|
|
887
878
|
}
|
|
888
|
-
),
|
|
889
|
-
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
890
|
-
showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
879
|
+
) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
891
880
|
/* @__PURE__ */ jsx(
|
|
892
881
|
AuthFormField,
|
|
893
882
|
{
|
|
@@ -922,12 +911,12 @@ function SignInForm({
|
|
|
922
911
|
] }),
|
|
923
912
|
!showVerificationStep && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
924
913
|
/* @__PURE__ */ jsx(AuthLink, { text: signUpText, linkText: signUpLinkText, href: signUpUrl }),
|
|
925
|
-
|
|
914
|
+
authConfig.oAuthProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
926
915
|
/* @__PURE__ */ jsx(AuthDivider, { text: dividerText }),
|
|
927
916
|
/* @__PURE__ */ jsx(
|
|
928
917
|
AuthOAuthProviders,
|
|
929
918
|
{
|
|
930
|
-
providers:
|
|
919
|
+
providers: authConfig.oAuthProviders,
|
|
931
920
|
onClick: onOAuthClick,
|
|
932
921
|
disabled: loading || oauthLoading !== null,
|
|
933
922
|
loading: oauthLoading
|
|
@@ -984,7 +973,7 @@ function SignIn({ onError, ...uiProps }) {
|
|
|
984
973
|
async function handleVerifyCode(code) {
|
|
985
974
|
setError("");
|
|
986
975
|
try {
|
|
987
|
-
const result = await verifyEmail(
|
|
976
|
+
const result = await verifyEmail(code, email);
|
|
988
977
|
if (result?.error) {
|
|
989
978
|
throw new Error(result.error.message || "Verification failed");
|
|
990
979
|
}
|
|
@@ -1002,7 +991,15 @@ function SignIn({ onError, ...uiProps }) {
|
|
|
1002
991
|
}
|
|
1003
992
|
}
|
|
1004
993
|
function handleOAuth(provider) {
|
|
1005
|
-
|
|
994
|
+
try {
|
|
995
|
+
loginWithOAuth(provider, redirectUrl || "");
|
|
996
|
+
} catch (err) {
|
|
997
|
+
const errorMessage = err instanceof Error ? err.message : "OAuth login failed";
|
|
998
|
+
setError(errorMessage);
|
|
999
|
+
if (onError) {
|
|
1000
|
+
onError(new Error(errorMessage));
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1006
1003
|
}
|
|
1007
1004
|
if (!authConfig) {
|
|
1008
1005
|
return null;
|
|
@@ -1018,7 +1015,6 @@ function SignIn({ onError, ...uiProps }) {
|
|
|
1018
1015
|
error,
|
|
1019
1016
|
loading,
|
|
1020
1017
|
oauthLoading,
|
|
1021
|
-
availableProviders: authConfig?.oAuthProviders || [],
|
|
1022
1018
|
onOAuthClick: handleOAuth,
|
|
1023
1019
|
authConfig,
|
|
1024
1020
|
showVerificationStep: step === "awaiting-verification",
|
|
@@ -1036,7 +1032,6 @@ function SignUpForm({
|
|
|
1036
1032
|
error,
|
|
1037
1033
|
loading = false,
|
|
1038
1034
|
oauthLoading = null,
|
|
1039
|
-
availableProviders = [],
|
|
1040
1035
|
onOAuthClick,
|
|
1041
1036
|
authConfig,
|
|
1042
1037
|
title = "Get Started",
|
|
@@ -1055,15 +1050,17 @@ function SignUpForm({
|
|
|
1055
1050
|
onVerifyCode
|
|
1056
1051
|
}) {
|
|
1057
1052
|
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
1058
|
-
/* @__PURE__ */ jsx(
|
|
1059
|
-
|
|
1053
|
+
/* @__PURE__ */ jsx(AuthHeader, { title, subtitle }),
|
|
1054
|
+
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
1055
|
+
showVerificationStep ? /* @__PURE__ */ jsx(
|
|
1056
|
+
AuthEmailVerificationStep,
|
|
1060
1057
|
{
|
|
1061
|
-
|
|
1062
|
-
|
|
1058
|
+
email,
|
|
1059
|
+
method: authConfig.verifyEmailMethod,
|
|
1060
|
+
onVerifyCode,
|
|
1061
|
+
emailSent: true
|
|
1063
1062
|
}
|
|
1064
|
-
),
|
|
1065
|
-
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
1066
|
-
showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
1063
|
+
) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
1067
1064
|
/* @__PURE__ */ jsx(
|
|
1068
1065
|
AuthFormField,
|
|
1069
1066
|
{
|
|
@@ -1086,7 +1083,6 @@ function SignUpForm({
|
|
|
1086
1083
|
value: password,
|
|
1087
1084
|
onChange: (e) => onPasswordChange(e.target.value),
|
|
1088
1085
|
required: true,
|
|
1089
|
-
minLength: authConfig.passwordMinLength,
|
|
1090
1086
|
autoComplete: "new-password",
|
|
1091
1087
|
showStrengthIndicator: true,
|
|
1092
1088
|
authConfig
|
|
@@ -1096,12 +1092,12 @@ function SignUpForm({
|
|
|
1096
1092
|
] }),
|
|
1097
1093
|
!showVerificationStep && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1098
1094
|
/* @__PURE__ */ jsx(AuthLink, { text: signInText, linkText: signInLinkText, href: signInUrl }),
|
|
1099
|
-
|
|
1095
|
+
authConfig.oAuthProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1100
1096
|
/* @__PURE__ */ jsx(AuthDivider, { text: dividerText }),
|
|
1101
1097
|
/* @__PURE__ */ jsx(
|
|
1102
1098
|
AuthOAuthProviders,
|
|
1103
1099
|
{
|
|
1104
|
-
providers:
|
|
1100
|
+
providers: authConfig.oAuthProviders,
|
|
1105
1101
|
onClick: onOAuthClick,
|
|
1106
1102
|
disabled: loading || oauthLoading !== null,
|
|
1107
1103
|
loading: oauthLoading
|
|
@@ -1211,7 +1207,7 @@ function SignUp({ onError, ...uiProps }) {
|
|
|
1211
1207
|
async function handleVerifyCode(code) {
|
|
1212
1208
|
setError("");
|
|
1213
1209
|
try {
|
|
1214
|
-
const result = await verifyEmail(
|
|
1210
|
+
const result = await verifyEmail(code, email);
|
|
1215
1211
|
if (result?.error) {
|
|
1216
1212
|
throw new Error(result.error.message || "Verification failed");
|
|
1217
1213
|
}
|
|
@@ -1229,7 +1225,15 @@ function SignUp({ onError, ...uiProps }) {
|
|
|
1229
1225
|
}
|
|
1230
1226
|
}
|
|
1231
1227
|
function handleOAuth(provider) {
|
|
1232
|
-
|
|
1228
|
+
try {
|
|
1229
|
+
loginWithOAuth(provider, redirectUrl || "");
|
|
1230
|
+
} catch (err) {
|
|
1231
|
+
const errorMessage = err instanceof Error ? err.message : "OAuth login failed";
|
|
1232
|
+
setError(errorMessage);
|
|
1233
|
+
if (onError) {
|
|
1234
|
+
onError(new Error(errorMessage));
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1233
1237
|
}
|
|
1234
1238
|
if (!authConfig) {
|
|
1235
1239
|
return null;
|
|
@@ -1245,7 +1249,6 @@ function SignUp({ onError, ...uiProps }) {
|
|
|
1245
1249
|
error,
|
|
1246
1250
|
loading,
|
|
1247
1251
|
oauthLoading,
|
|
1248
|
-
availableProviders: authConfig?.oAuthProviders || [],
|
|
1249
1252
|
onOAuthClick: handleOAuth,
|
|
1250
1253
|
authConfig,
|
|
1251
1254
|
showVerificationStep: step === "awaiting-verification",
|
|
@@ -1261,10 +1264,10 @@ function ForgotPasswordForm({
|
|
|
1261
1264
|
error,
|
|
1262
1265
|
loading = false,
|
|
1263
1266
|
title = "Forgot Password?",
|
|
1264
|
-
subtitle = "Enter your email address and we'll send you a
|
|
1267
|
+
subtitle = "Enter your email address and we'll send you a {method} to reset your password.",
|
|
1265
1268
|
emailLabel = "Email",
|
|
1266
1269
|
emailPlaceholder = "example@email.com",
|
|
1267
|
-
submitButtonText = "
|
|
1270
|
+
submitButtonText = "Reset Password",
|
|
1268
1271
|
loadingButtonText = "Sending...",
|
|
1269
1272
|
backToSignInText = "Remember your password?",
|
|
1270
1273
|
backToSignInUrl = "/sign-in",
|
|
@@ -1273,14 +1276,9 @@ function ForgotPasswordForm({
|
|
|
1273
1276
|
onVerifyCode,
|
|
1274
1277
|
onResendEmail
|
|
1275
1278
|
}) {
|
|
1279
|
+
const displaySubtitle = subtitle.replace("{method}", resetPasswordMethod);
|
|
1276
1280
|
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
1277
|
-
/* @__PURE__ */ jsx(
|
|
1278
|
-
AuthHeader,
|
|
1279
|
-
{
|
|
1280
|
-
title: showVerificationStep ? resetPasswordMethod === "link" ? "Check Your Email" : "Enter Reset Code" : title,
|
|
1281
|
-
subtitle: showVerificationStep ? "" : subtitle
|
|
1282
|
-
}
|
|
1283
|
-
),
|
|
1281
|
+
/* @__PURE__ */ jsx(AuthHeader, { title, subtitle: displaySubtitle }),
|
|
1284
1282
|
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
1285
1283
|
showVerificationStep ? /* @__PURE__ */ jsx(
|
|
1286
1284
|
AuthResetPasswordVerificationStep,
|