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