@insforge/react 0.3.0 → 0.3.2

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/forms.d.mts CHANGED
@@ -37,7 +37,7 @@ import '@insforge/shared-schemas';
37
37
  * />
38
38
  * ```
39
39
  */
40
- declare function SignInForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, forgotPasswordText, forgotPasswordUrl, submitButtonText, loadingButtonText, signUpText, signUpLinkText, signUpUrl, dividerText, }: SignInFormProps): react_jsx_runtime.JSX.Element;
40
+ declare function SignInForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, forgotPasswordText, forgotPasswordUrl, submitButtonText, loadingButtonText, signUpText, signUpLinkText, signUpUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignInFormProps): react_jsx_runtime.JSX.Element;
41
41
 
42
42
  /**
43
43
  * Pre-built sign-up form component (UI only, no business logic).
@@ -73,7 +73,7 @@ declare function SignInForm({ email, password, onEmailChange, onPasswordChange,
73
73
  * />
74
74
  * ```
75
75
  */
76
- declare function SignUpForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, submitButtonText, loadingButtonText, signInText, signInLinkText, signInUrl, dividerText, }: SignUpFormProps): react_jsx_runtime.JSX.Element;
76
+ declare function SignUpForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, submitButtonText, loadingButtonText, signInText, signInLinkText, signInUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignUpFormProps): react_jsx_runtime.JSX.Element;
77
77
 
78
78
  /**
79
79
  * Pre-built forgot password form component (UI only, no business logic).
@@ -150,7 +150,7 @@ declare function ForgotPasswordForm({ email, onEmailChange, onSubmit, error, loa
150
150
  * />
151
151
  * ```
152
152
  */
153
- declare function ResetPasswordForm({ newPassword, confirmPassword, onNewPasswordChange, onConfirmPasswordChange, onSubmit, error, loading, emailAuthConfig, appearance, title, subtitle, newPasswordLabel, newPasswordPlaceholder, confirmPasswordLabel, confirmPasswordPlaceholder, submitButtonText, loadingButtonText, backToSignInText, backToSignInUrl, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
153
+ declare function ResetPasswordForm({ newPassword, confirmPassword, onNewPasswordChange, onConfirmPasswordChange, onSubmit, error, loading, success, emailAuthConfig, appearance, title, subtitle, newPasswordLabel, newPasswordPlaceholder, confirmPasswordLabel, confirmPasswordPlaceholder, submitButtonText, loadingButtonText, backToSignInText, backToSignInUrl, successTitle, successMessage, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
154
154
 
155
155
  /**
156
156
  * Email verification status display component (UI only, no business logic).
package/dist/forms.d.ts CHANGED
@@ -37,7 +37,7 @@ import '@insforge/shared-schemas';
37
37
  * />
38
38
  * ```
39
39
  */
40
- declare function SignInForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, forgotPasswordText, forgotPasswordUrl, submitButtonText, loadingButtonText, signUpText, signUpLinkText, signUpUrl, dividerText, }: SignInFormProps): react_jsx_runtime.JSX.Element;
40
+ declare function SignInForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, forgotPasswordText, forgotPasswordUrl, submitButtonText, loadingButtonText, signUpText, signUpLinkText, signUpUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignInFormProps): react_jsx_runtime.JSX.Element;
41
41
 
42
42
  /**
43
43
  * Pre-built sign-up form component (UI only, no business logic).
@@ -73,7 +73,7 @@ declare function SignInForm({ email, password, onEmailChange, onPasswordChange,
73
73
  * />
74
74
  * ```
75
75
  */
76
- declare function SignUpForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, submitButtonText, loadingButtonText, signInText, signInLinkText, signInUrl, dividerText, }: SignUpFormProps): react_jsx_runtime.JSX.Element;
76
+ declare function SignUpForm({ email, password, onEmailChange, onPasswordChange, onSubmit, error, loading, oauthLoading, availableProviders, onOAuthClick, emailAuthConfig, appearance, title, subtitle, emailLabel, emailPlaceholder, passwordLabel, passwordPlaceholder, submitButtonText, loadingButtonText, signInText, signInLinkText, signInUrl, dividerText, showVerificationStep, onVerifyCode, verificationDescription, }: SignUpFormProps): react_jsx_runtime.JSX.Element;
77
77
 
78
78
  /**
79
79
  * Pre-built forgot password form component (UI only, no business logic).
@@ -150,7 +150,7 @@ declare function ForgotPasswordForm({ email, onEmailChange, onSubmit, error, loa
150
150
  * />
151
151
  * ```
152
152
  */
153
- declare function ResetPasswordForm({ newPassword, confirmPassword, onNewPasswordChange, onConfirmPasswordChange, onSubmit, error, loading, emailAuthConfig, appearance, title, subtitle, newPasswordLabel, newPasswordPlaceholder, confirmPasswordLabel, confirmPasswordPlaceholder, submitButtonText, loadingButtonText, backToSignInText, backToSignInUrl, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
153
+ declare function ResetPasswordForm({ newPassword, confirmPassword, onNewPasswordChange, onConfirmPasswordChange, onSubmit, error, loading, success, emailAuthConfig, appearance, title, subtitle, newPasswordLabel, newPasswordPlaceholder, confirmPasswordLabel, confirmPasswordPlaceholder, submitButtonText, loadingButtonText, backToSignInText, backToSignInUrl, successTitle, successMessage, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
154
154
 
155
155
  /**
156
156
  * Email verification status display component (UI only, no business logic).
package/dist/forms.js CHANGED
@@ -5,7 +5,7 @@ var clsx = require('clsx');
5
5
  var tailwindMerge = require('tailwind-merge');
6
6
  var lucideReact = require('lucide-react');
7
7
  var react = require('react');
8
- require('@insforge/sdk');
8
+ var sdk = require('@insforge/sdk');
9
9
 
10
10
  function AuthBranding() {
11
11
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-[#FAFAFA] px-2 py-4 flex flex-row justify-center items-center gap-1", children: [
@@ -645,9 +645,221 @@ function AuthOAuthProviders({
645
645
  provider
646
646
  )) });
647
647
  }
648
- react.createContext(
648
+ function AuthVerificationCodeInput({
649
+ length = 6,
650
+ value,
651
+ email,
652
+ onChange,
653
+ disabled = false,
654
+ onComplete,
655
+ appearance = {}
656
+ }) {
657
+ const inputRefs = react.useRef([]);
658
+ const handleChange = (index, digit) => {
659
+ if (digit.length > 1) return;
660
+ if (digit && !/^\d$/.test(digit)) return;
661
+ const newValue = value.split("");
662
+ newValue[index] = digit;
663
+ const updatedValue = newValue.join("");
664
+ onChange(updatedValue);
665
+ if (digit && index < length - 1) {
666
+ inputRefs.current[index + 1]?.focus();
667
+ }
668
+ if (digit && index === length - 1 && updatedValue.length === length && onComplete) {
669
+ onComplete(updatedValue);
670
+ }
671
+ };
672
+ const handleKeyDown = (index, e) => {
673
+ if (e.key === "Backspace") {
674
+ if (!value[index] && index > 0) {
675
+ inputRefs.current[index - 1]?.focus();
676
+ } else {
677
+ handleChange(index, "");
678
+ }
679
+ } else if (e.key === "ArrowLeft" && index > 0) {
680
+ inputRefs.current[index - 1]?.focus();
681
+ } else if (e.key === "ArrowRight" && index < length - 1) {
682
+ inputRefs.current[index + 1]?.focus();
683
+ }
684
+ };
685
+ const handlePaste = (e) => {
686
+ e.preventDefault();
687
+ const pastedData = e.clipboardData.getData("text/plain").trim();
688
+ if (/^\d+$/.test(pastedData) && pastedData.length === length) {
689
+ onChange(pastedData);
690
+ inputRefs.current[length - 1]?.focus();
691
+ if (onComplete) {
692
+ onComplete(pastedData);
693
+ }
694
+ }
695
+ };
696
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
697
+ "flex flex-col justify-center items-center gap-6",
698
+ appearance.containerClassName
699
+ ), children: [
700
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm font-normal text-[#525252] leading-5", children: [
701
+ "We've sent a verification code to your inbox at",
702
+ " ",
703
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-black leading-5", children: email }),
704
+ ". Enter it below to proceed."
705
+ ] }),
706
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-3 justify-center items-center", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
707
+ "input",
708
+ {
709
+ ref: (el) => {
710
+ inputRefs.current[index] = el;
711
+ },
712
+ type: "text",
713
+ inputMode: "numeric",
714
+ maxLength: 1,
715
+ value: value[index] || "",
716
+ onChange: (e) => handleChange(index, e.target.value),
717
+ onKeyDown: (e) => handleKeyDown(index, e),
718
+ onPaste: handlePaste,
719
+ disabled,
720
+ className: cn(
721
+ "w-full h-12 px-3 py-2 rounded border border-[#E0E0E0] bg-white",
722
+ "text-center text-base font-semibold leading-5 text-black",
723
+ "transition-all duration-200 outline-none",
724
+ "focus:border-black focus:shadow-[0_0_0_2px_rgba(0,0,0,0.1)]",
725
+ "disabled:bg-[#F5F5F5] disabled:cursor-not-allowed disabled:opacity-60",
726
+ appearance.inputClassName
727
+ ),
728
+ autoComplete: "one-time-code"
729
+ },
730
+ index
731
+ )) })
732
+ ] });
733
+ }
734
+ var InsforgeContext = react.createContext(
649
735
  void 0
650
736
  );
737
+ function useInsforge() {
738
+ const context = react.useContext(InsforgeContext);
739
+ if (!context) {
740
+ throw new Error("useInsforge must be used within InsforgeProvider");
741
+ }
742
+ return context;
743
+ }
744
+ function AuthEmailVerificationStep({
745
+ email,
746
+ description,
747
+ method = "code",
748
+ onVerifyCode
749
+ }) {
750
+ const { baseUrl } = useInsforge();
751
+ const [insforge] = react.useState(() => sdk.createClient({ baseUrl }));
752
+ const [resendDisabled, setResendDisabled] = react.useState(true);
753
+ const [resendCountdown, setResendCountdown] = react.useState(60);
754
+ const [isSending, setIsSending] = react.useState(false);
755
+ const [verificationCode, setVerificationCode] = react.useState("");
756
+ const [isVerifying, setIsVerifying] = react.useState(false);
757
+ const [verificationError, setVerificationError] = react.useState("");
758
+ const defaultDescription = method === "code" ? "We've sent a 6-digit verification code to {email}. Please enter it below to verify your account. The code will expire in 10 minutes." : "We've sent a verification link to {email}. Please check your email and click the link to verify your account. The link will expire in 10 minutes.";
759
+ react.useEffect(() => {
760
+ const sendInitialEmail = async () => {
761
+ try {
762
+ if (method === "code") {
763
+ await insforge.auth.sendVerificationCode({ email });
764
+ } else {
765
+ await insforge.auth.sendVerificationLink({ email });
766
+ }
767
+ } catch {
768
+ }
769
+ };
770
+ void sendInitialEmail();
771
+ }, [email, method, insforge.auth]);
772
+ react.useEffect(() => {
773
+ if (resendCountdown > 0) {
774
+ const timer = setInterval(() => {
775
+ setResendCountdown((prev) => {
776
+ if (prev <= 1) {
777
+ setResendDisabled(false);
778
+ return 0;
779
+ }
780
+ return prev - 1;
781
+ });
782
+ }, 1e3);
783
+ return () => clearInterval(timer);
784
+ }
785
+ }, [resendCountdown]);
786
+ const handleResend = async () => {
787
+ setResendDisabled(true);
788
+ setResendCountdown(60);
789
+ setIsSending(true);
790
+ setVerificationError("");
791
+ try {
792
+ if (method === "code") {
793
+ await insforge.auth.sendVerificationCode({ email });
794
+ } else {
795
+ await insforge.auth.sendVerificationLink({ email });
796
+ }
797
+ } catch {
798
+ setResendDisabled(false);
799
+ setResendCountdown(0);
800
+ } finally {
801
+ setIsSending(false);
802
+ }
803
+ };
804
+ const handleVerifyCode = async (code) => {
805
+ if (!onVerifyCode) {
806
+ return;
807
+ }
808
+ setIsVerifying(true);
809
+ setVerificationError("");
810
+ try {
811
+ await onVerifyCode(code);
812
+ } catch (error) {
813
+ setVerificationError(
814
+ error instanceof Error ? error.message : "Invalid verification code. Please try again."
815
+ );
816
+ setVerificationCode("");
817
+ } finally {
818
+ setIsVerifying(false);
819
+ }
820
+ };
821
+ const displayDescription = description || defaultDescription;
822
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6 items-stretch", children: [
823
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 leading-relaxed", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
824
+ part,
825
+ index < array.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-black dark:text-white", children: email })
826
+ ] }, index)) }),
827
+ verificationError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pl-3 py-2 pr-2 bg-red-50 border-2 border-red-600 rounded", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
828
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-6 h-6 text-red-500 shrink-0", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
829
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-red-600 flex-1", children: verificationError })
830
+ ] }) }),
831
+ method === "code" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full bg-neutral-100 dark:bg-neutral-800 rounded-lg px-4 pt-4 pb-6 flex flex-col gap-4", children: [
832
+ /* @__PURE__ */ jsxRuntime.jsx(
833
+ AuthVerificationCodeInput,
834
+ {
835
+ value: verificationCode,
836
+ onChange: setVerificationCode,
837
+ email,
838
+ disabled: isVerifying,
839
+ onComplete: (code) => {
840
+ void handleVerifyCode(code);
841
+ }
842
+ }
843
+ ),
844
+ isVerifying && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: "Verifying..." })
845
+ ] }),
846
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full text-sm text-center text-neutral-600 dark:text-neutral-400", children: [
847
+ "Didn't receive the email?",
848
+ " ",
849
+ /* @__PURE__ */ jsxRuntime.jsx(
850
+ "button",
851
+ {
852
+ onClick: () => {
853
+ void handleResend();
854
+ },
855
+ disabled: resendDisabled || isSending,
856
+ className: "text-black dark:text-white font-medium transition-colors disabled:cursor-not-allowed cursor-pointer hover:underline disabled:no-underline disabled:opacity-50",
857
+ children: isSending ? "Sending..." : resendDisabled ? `Retry in (${resendCountdown}s)` : "Click to resend"
858
+ }
859
+ )
860
+ ] })
861
+ ] });
862
+ }
651
863
  function SignInForm({
652
864
  email,
653
865
  password,
@@ -674,7 +886,11 @@ function SignInForm({
674
886
  signUpText = "Don't have an account?",
675
887
  signUpLinkText = "Sign Up Now",
676
888
  signUpUrl = "/sign-up",
677
- dividerText = "or"
889
+ dividerText = "or",
890
+ // Email verification step props
891
+ showVerificationStep = false,
892
+ onVerifyCode,
893
+ verificationDescription
678
894
  }) {
679
895
  return /* @__PURE__ */ jsxRuntime.jsxs(
680
896
  AuthContainer,
@@ -687,8 +903,8 @@ function SignInForm({
687
903
  /* @__PURE__ */ jsxRuntime.jsx(
688
904
  AuthHeader,
689
905
  {
690
- title,
691
- subtitle,
906
+ title: showVerificationStep ? "Verify Your Email" : title,
907
+ subtitle: showVerificationStep ? "" : subtitle,
692
908
  appearance: {
693
909
  containerClassName: appearance.header?.container,
694
910
  titleClassName: appearance.header?.title,
@@ -703,7 +919,14 @@ function SignInForm({
703
919
  className: appearance.errorBanner
704
920
  }
705
921
  ),
706
- /* @__PURE__ */ jsxRuntime.jsxs(
922
+ showVerificationStep ? /* @__PURE__ */ jsxRuntime.jsx(
923
+ AuthEmailVerificationStep,
924
+ {
925
+ email,
926
+ description: verificationDescription,
927
+ onVerifyCode
928
+ }
929
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
707
930
  "form",
708
931
  {
709
932
  onSubmit,
@@ -762,39 +985,41 @@ function SignInForm({
762
985
  ]
763
986
  }
764
987
  ),
765
- /* @__PURE__ */ jsxRuntime.jsx(
766
- AuthLink,
767
- {
768
- text: signUpText,
769
- linkText: signUpLinkText,
770
- href: signUpUrl,
771
- appearance: {
772
- containerClassName: appearance.link?.container,
773
- linkClassName: appearance.link?.link
774
- }
775
- }
776
- ),
777
- availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
988
+ !showVerificationStep && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
778
989
  /* @__PURE__ */ jsxRuntime.jsx(
779
- AuthDivider,
990
+ AuthLink,
780
991
  {
781
- text: dividerText,
782
- className: appearance.divider
783
- }
784
- ),
785
- /* @__PURE__ */ jsxRuntime.jsx(
786
- AuthOAuthProviders,
787
- {
788
- providers: availableProviders,
789
- onClick: onOAuthClick,
790
- disabled: loading || oauthLoading !== null,
791
- loading: oauthLoading,
992
+ text: signUpText,
993
+ linkText: signUpLinkText,
994
+ href: signUpUrl,
792
995
  appearance: {
793
- containerClassName: appearance.oauth?.container,
794
- buttonClassName: appearance.oauth?.button
996
+ containerClassName: appearance.link?.container,
997
+ linkClassName: appearance.link?.link
795
998
  }
796
999
  }
797
- )
1000
+ ),
1001
+ availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1002
+ /* @__PURE__ */ jsxRuntime.jsx(
1003
+ AuthDivider,
1004
+ {
1005
+ text: dividerText,
1006
+ className: appearance.divider
1007
+ }
1008
+ ),
1009
+ /* @__PURE__ */ jsxRuntime.jsx(
1010
+ AuthOAuthProviders,
1011
+ {
1012
+ providers: availableProviders,
1013
+ onClick: onOAuthClick,
1014
+ disabled: loading || oauthLoading !== null,
1015
+ loading: oauthLoading,
1016
+ appearance: {
1017
+ containerClassName: appearance.oauth?.container,
1018
+ buttonClassName: appearance.oauth?.button
1019
+ }
1020
+ }
1021
+ )
1022
+ ] })
798
1023
  ] })
799
1024
  ]
800
1025
  }
@@ -824,7 +1049,11 @@ function SignUpForm({
824
1049
  signInText = "Already have an account?",
825
1050
  signInLinkText = "Login Now",
826
1051
  signInUrl = "/sign-in",
827
- dividerText = "or"
1052
+ dividerText = "or",
1053
+ // Email verification step props
1054
+ showVerificationStep = false,
1055
+ onVerifyCode,
1056
+ verificationDescription
828
1057
  }) {
829
1058
  return /* @__PURE__ */ jsxRuntime.jsxs(
830
1059
  AuthContainer,
@@ -837,8 +1066,8 @@ function SignUpForm({
837
1066
  /* @__PURE__ */ jsxRuntime.jsx(
838
1067
  AuthHeader,
839
1068
  {
840
- title,
841
- subtitle,
1069
+ title: showVerificationStep ? "Verify Your Email" : title,
1070
+ subtitle: showVerificationStep ? "" : subtitle,
842
1071
  appearance: {
843
1072
  containerClassName: appearance.header?.container,
844
1073
  titleClassName: appearance.header?.title,
@@ -853,7 +1082,14 @@ function SignUpForm({
853
1082
  className: appearance.errorBanner
854
1083
  }
855
1084
  ),
856
- /* @__PURE__ */ jsxRuntime.jsxs(
1085
+ showVerificationStep ? /* @__PURE__ */ jsxRuntime.jsx(
1086
+ AuthEmailVerificationStep,
1087
+ {
1088
+ email,
1089
+ description: verificationDescription,
1090
+ onVerifyCode
1091
+ }
1092
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
857
1093
  "form",
858
1094
  {
859
1095
  onSubmit,
@@ -910,39 +1146,41 @@ function SignUpForm({
910
1146
  ]
911
1147
  }
912
1148
  ),
913
- /* @__PURE__ */ jsxRuntime.jsx(
914
- AuthLink,
915
- {
916
- text: signInText,
917
- linkText: signInLinkText,
918
- href: signInUrl,
919
- appearance: {
920
- containerClassName: appearance.link?.container,
921
- linkClassName: appearance.link?.link
922
- }
923
- }
924
- ),
925
- availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
926
- /* @__PURE__ */ jsxRuntime.jsx(
927
- AuthDivider,
928
- {
929
- text: dividerText,
930
- className: appearance.divider
931
- }
932
- ),
1149
+ !showVerificationStep && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
933
1150
  /* @__PURE__ */ jsxRuntime.jsx(
934
- AuthOAuthProviders,
1151
+ AuthLink,
935
1152
  {
936
- providers: availableProviders,
937
- onClick: onOAuthClick,
938
- disabled: loading || oauthLoading !== null,
939
- loading: oauthLoading,
1153
+ text: signInText,
1154
+ linkText: signInLinkText,
1155
+ href: signInUrl,
940
1156
  appearance: {
941
- containerClassName: appearance.oauth?.container,
942
- buttonClassName: appearance.oauth?.button
1157
+ containerClassName: appearance.link?.container,
1158
+ linkClassName: appearance.link?.link
943
1159
  }
944
1160
  }
945
- )
1161
+ ),
1162
+ availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1163
+ /* @__PURE__ */ jsxRuntime.jsx(
1164
+ AuthDivider,
1165
+ {
1166
+ text: dividerText,
1167
+ className: appearance.divider
1168
+ }
1169
+ ),
1170
+ /* @__PURE__ */ jsxRuntime.jsx(
1171
+ AuthOAuthProviders,
1172
+ {
1173
+ providers: availableProviders,
1174
+ onClick: onOAuthClick,
1175
+ disabled: loading || oauthLoading !== null,
1176
+ loading: oauthLoading,
1177
+ appearance: {
1178
+ containerClassName: appearance.oauth?.container,
1179
+ buttonClassName: appearance.oauth?.button
1180
+ }
1181
+ }
1182
+ )
1183
+ ] })
946
1184
  ] })
947
1185
  ]
948
1186
  }
@@ -1072,6 +1310,7 @@ function ResetPasswordForm({
1072
1310
  onSubmit,
1073
1311
  error,
1074
1312
  loading = false,
1313
+ success = false,
1075
1314
  emailAuthConfig,
1076
1315
  appearance = {},
1077
1316
  title = "Reset Password",
@@ -1083,8 +1322,27 @@ function ResetPasswordForm({
1083
1322
  submitButtonText = "Reset Password",
1084
1323
  loadingButtonText = "Resetting...",
1085
1324
  backToSignInText = "",
1086
- backToSignInUrl = "/sign-in"
1325
+ backToSignInUrl = "/sign-in",
1326
+ successTitle = "Password Reset Successful!",
1327
+ successMessage = "Your password has been successfully reset. You can now sign in with your new password."
1087
1328
  }) {
1329
+ if (success) {
1330
+ return /* @__PURE__ */ jsxRuntime.jsx(
1331
+ AuthContainer,
1332
+ {
1333
+ appearance: {
1334
+ containerClassName: appearance.container,
1335
+ cardClassName: appearance.card
1336
+ },
1337
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
1338
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-full bg-green-100 dark:bg-green-900 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-8 h-8 text-green-600 dark:text-green-400", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" }) }) }),
1339
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white text-center", children: successTitle }),
1340
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: successMessage }),
1341
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "mt-4 text-black dark:text-white font-medium", children: "Back to Sign In" })
1342
+ ] })
1343
+ }
1344
+ );
1345
+ }
1088
1346
  return /* @__PURE__ */ jsxRuntime.jsxs(
1089
1347
  AuthContainer,
1090
1348
  {
@@ -1168,13 +1426,18 @@ function ResetPasswordForm({
1168
1426
  ]
1169
1427
  }
1170
1428
  ),
1171
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: appearance.backToSignIn || "text-center text-sm text-gray-600 dark:text-gray-400", children: [
1172
- backToSignInText && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1173
- backToSignInText,
1174
- " "
1175
- ] }),
1176
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "text-black dark:text-white font-medium", children: "Back to Sign In" })
1177
- ] })
1429
+ /* @__PURE__ */ jsxRuntime.jsx(
1430
+ AuthLink,
1431
+ {
1432
+ text: backToSignInText,
1433
+ linkText: "Back to Sign In",
1434
+ href: backToSignInUrl,
1435
+ appearance: {
1436
+ containerClassName: appearance.link?.container,
1437
+ linkClassName: appearance.link?.link
1438
+ }
1439
+ }
1440
+ )
1178
1441
  ]
1179
1442
  }
1180
1443
  );