@insforge/react 0.4.0 → 0.4.5
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 +2 -11
- package/dist/atoms.cjs +158 -139
- package/dist/atoms.cjs.map +1 -1
- package/dist/atoms.d.cts +72 -41
- package/dist/atoms.d.ts +72 -41
- package/dist/atoms.js +159 -141
- package/dist/atoms.js.map +1 -1
- package/dist/components.cjs +544 -798
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +64 -94
- package/dist/components.d.ts +64 -94
- package/dist/components.js +544 -798
- package/dist/components.js.map +1 -1
- package/dist/forms.cjs +217 -310
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.d.cts +10 -13
- package/dist/forms.d.ts +10 -13
- package/dist/forms.js +218 -311
- 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 +581 -794
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -16
- package/dist/index.d.ts +31 -16
- package/dist/index.js +581 -794
- package/dist/index.js.map +1 -1
- package/dist/router.cjs.map +1 -1
- package/dist/router.d.cts +0 -11
- package/dist/router.d.ts +0 -11
- package/dist/router.js.map +1 -1
- package/dist/styles.css +212 -3
- package/dist/types.d.cts +11 -613
- package/dist/types.d.ts +11 -613
- package/package.json +7 -2
package/dist/forms.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { AlertTriangle, EyeOff, Eye, Loader2, CircleCheck, Check } from 'lucide-react';
|
|
3
|
-
import { createContext, useState, useEffect, useContext, useRef } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { createContext, useState, useEffect, useCallback, useContext, useRef } from 'react';
|
|
4
|
+
import { useSearchParams } from 'react-router-dom';
|
|
5
|
+
import '@insforge/sdk';
|
|
5
6
|
|
|
6
7
|
function AuthBranding() {
|
|
7
8
|
return /* @__PURE__ */ jsxs("div", { className: "if-authBranding if-internal-ab4k9w", children: [
|
|
@@ -89,21 +90,12 @@ function AuthErrorBanner({ error }) {
|
|
|
89
90
|
if (!error) {
|
|
90
91
|
return null;
|
|
91
92
|
}
|
|
92
|
-
return /* @__PURE__ */ jsx("div", { className: "if-errorBanner if-internal-eb2m7k", children: /* @__PURE__ */ jsxs("div", {
|
|
93
|
-
/* @__PURE__ */ jsx(
|
|
94
|
-
AlertTriangle,
|
|
95
|
-
{
|
|
96
|
-
style: { width: "1.5rem", height: "1.5rem", flexShrink: 0, color: "#dc2626" }
|
|
97
|
-
}
|
|
98
|
-
),
|
|
93
|
+
return /* @__PURE__ */ jsx("div", { className: "if-errorBanner if-internal-eb2m7k", children: /* @__PURE__ */ jsxs("div", { className: "if-errorBanner-content", children: [
|
|
94
|
+
/* @__PURE__ */ jsx(AlertTriangle, { className: "if-errorBanner-icon" }),
|
|
99
95
|
/* @__PURE__ */ jsx("span", { className: "if-errorBanner-text", children: error })
|
|
100
96
|
] }) });
|
|
101
97
|
}
|
|
102
|
-
function AuthFormField({
|
|
103
|
-
label,
|
|
104
|
-
id,
|
|
105
|
-
...props
|
|
106
|
-
}) {
|
|
98
|
+
function AuthFormField({ label, id, ...props }) {
|
|
107
99
|
return /* @__PURE__ */ jsxs("div", { className: "if-formField if-internal-f9n6p2", children: [
|
|
108
100
|
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "if-formField-label if-internal-l3k8m1", children: label }),
|
|
109
101
|
/* @__PURE__ */ jsx("input", { id, className: "if-formField-input if-internal-i2v8k4", ...props })
|
|
@@ -230,14 +222,17 @@ function AuthSubmitButton({
|
|
|
230
222
|
children,
|
|
231
223
|
isLoading = false,
|
|
232
224
|
confirmed = false,
|
|
233
|
-
disabled = false
|
|
225
|
+
disabled = false,
|
|
226
|
+
type = "submit",
|
|
227
|
+
onClick
|
|
234
228
|
}) {
|
|
235
229
|
return /* @__PURE__ */ jsxs(
|
|
236
230
|
"button",
|
|
237
231
|
{
|
|
238
|
-
type
|
|
232
|
+
type,
|
|
239
233
|
className: "if-submitButton if-internal-b8p3m4",
|
|
240
234
|
disabled: disabled || isLoading || confirmed,
|
|
235
|
+
onClick,
|
|
241
236
|
children: [
|
|
242
237
|
isLoading && /* @__PURE__ */ jsx(Loader2, { className: "if-submitButton-icon if-submitButton-spinner", size: 20 }),
|
|
243
238
|
confirmed && /* @__PURE__ */ jsx(CircleCheck, { className: "if-submitButton-icon", size: 20 }),
|
|
@@ -246,24 +241,16 @@ function AuthSubmitButton({
|
|
|
246
241
|
}
|
|
247
242
|
);
|
|
248
243
|
}
|
|
249
|
-
function AuthLink({
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
href
|
|
253
|
-
}) {
|
|
254
|
-
const currentSearch = typeof window !== "undefined" ? window.location.search : "";
|
|
244
|
+
function AuthLink({ text, linkText, href }) {
|
|
245
|
+
const [searchParams] = useSearchParams();
|
|
246
|
+
const currentSearch = searchParams.toString();
|
|
255
247
|
const finalHref = (() => {
|
|
256
248
|
if (!currentSearch) {
|
|
257
249
|
return href;
|
|
258
250
|
}
|
|
259
251
|
try {
|
|
260
252
|
const url = new URL(href, window.location.origin);
|
|
261
|
-
|
|
262
|
-
currentParams.forEach((value, key) => {
|
|
263
|
-
if (!url.searchParams.has(key)) {
|
|
264
|
-
url.searchParams.set(key, value);
|
|
265
|
-
}
|
|
266
|
-
});
|
|
253
|
+
url.search = currentSearch;
|
|
267
254
|
return url.pathname + url.search;
|
|
268
255
|
} catch {
|
|
269
256
|
return href;
|
|
@@ -628,28 +615,26 @@ function useInsforge() {
|
|
|
628
615
|
}
|
|
629
616
|
function AuthEmailVerificationStep({
|
|
630
617
|
email,
|
|
631
|
-
description,
|
|
632
618
|
method = "code",
|
|
633
619
|
onVerifyCode
|
|
634
620
|
}) {
|
|
635
|
-
const {
|
|
636
|
-
const [insforge] = useState(() => createClient({ baseUrl }));
|
|
621
|
+
const { sendVerificationEmail } = useInsforge();
|
|
637
622
|
const [resendDisabled, setResendDisabled] = useState(true);
|
|
638
623
|
const [resendCountdown, setResendCountdown] = useState(60);
|
|
639
624
|
const [isSending, setIsSending] = useState(false);
|
|
640
625
|
const [verificationCode, setVerificationCode] = useState("");
|
|
641
626
|
const [isVerifying, setIsVerifying] = useState(false);
|
|
642
|
-
const [verificationError, setVerificationError] = useState("");
|
|
643
627
|
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.";
|
|
644
628
|
useEffect(() => {
|
|
645
629
|
const sendInitialEmail = async () => {
|
|
646
630
|
try {
|
|
647
|
-
await
|
|
648
|
-
} catch {
|
|
631
|
+
await sendVerificationEmail(email);
|
|
632
|
+
} catch (error) {
|
|
633
|
+
console.error("Failed to send verification email:", error);
|
|
649
634
|
}
|
|
650
635
|
};
|
|
651
636
|
void sendInitialEmail();
|
|
652
|
-
}, [email,
|
|
637
|
+
}, [email, sendVerificationEmail]);
|
|
653
638
|
useEffect(() => {
|
|
654
639
|
if (resendCountdown > 0) {
|
|
655
640
|
const timer = setInterval(() => {
|
|
@@ -668,9 +653,8 @@ function AuthEmailVerificationStep({
|
|
|
668
653
|
setResendDisabled(true);
|
|
669
654
|
setResendCountdown(60);
|
|
670
655
|
setIsSending(true);
|
|
671
|
-
setVerificationError("");
|
|
672
656
|
try {
|
|
673
|
-
await
|
|
657
|
+
await sendVerificationEmail(email);
|
|
674
658
|
} catch {
|
|
675
659
|
setResendDisabled(false);
|
|
676
660
|
setResendCountdown(0);
|
|
@@ -678,123 +662,157 @@ function AuthEmailVerificationStep({
|
|
|
678
662
|
setIsSending(false);
|
|
679
663
|
}
|
|
680
664
|
};
|
|
681
|
-
const
|
|
682
|
-
if (!onVerifyCode) {
|
|
665
|
+
const handleSubmit = async () => {
|
|
666
|
+
if (!onVerifyCode || verificationCode.length !== 6) {
|
|
683
667
|
return;
|
|
684
668
|
}
|
|
685
669
|
setIsVerifying(true);
|
|
686
|
-
setVerificationError("");
|
|
687
670
|
try {
|
|
688
|
-
await onVerifyCode(
|
|
689
|
-
} catch (error) {
|
|
690
|
-
setVerificationError(
|
|
691
|
-
error instanceof Error ? error.message : "Invalid verification code. Please try again."
|
|
692
|
-
);
|
|
693
|
-
setVerificationCode("");
|
|
671
|
+
await onVerifyCode(verificationCode);
|
|
694
672
|
} finally {
|
|
695
673
|
setIsVerifying(false);
|
|
674
|
+
setVerificationCode("");
|
|
696
675
|
}
|
|
697
676
|
};
|
|
698
|
-
const displayDescription =
|
|
699
|
-
|
|
700
|
-
|
|
677
|
+
const displayDescription = defaultDescription;
|
|
678
|
+
const isLinkMethod = method === "link";
|
|
679
|
+
return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
|
|
680
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
|
|
701
681
|
part,
|
|
702
682
|
index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationCode-email", children: email })
|
|
703
683
|
] }, index)) }),
|
|
704
|
-
|
|
684
|
+
!isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
|
|
685
|
+
/* @__PURE__ */ jsx("div", { className: "if-verificationStep-codeInputWrapper", children: /* @__PURE__ */ jsx(
|
|
686
|
+
AuthVerificationCodeInput,
|
|
687
|
+
{
|
|
688
|
+
value: verificationCode,
|
|
689
|
+
onChange: setVerificationCode,
|
|
690
|
+
email,
|
|
691
|
+
disabled: isVerifying
|
|
692
|
+
}
|
|
693
|
+
) }),
|
|
705
694
|
/* @__PURE__ */ jsx(
|
|
706
|
-
|
|
695
|
+
AuthSubmitButton,
|
|
707
696
|
{
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
children: /* @__PURE__ */ 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" })
|
|
697
|
+
type: "button",
|
|
698
|
+
isLoading: isVerifying,
|
|
699
|
+
disabled: isVerifying || verificationCode.length !== 6,
|
|
700
|
+
onClick: () => {
|
|
701
|
+
void handleSubmit();
|
|
702
|
+
},
|
|
703
|
+
children: isVerifying ? "Verifying..." : "Verify Code"
|
|
716
704
|
}
|
|
717
|
-
)
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
"
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
705
|
+
)
|
|
706
|
+
] }),
|
|
707
|
+
/* @__PURE__ */ jsxs("div", { className: "if-verificationStep-resendContainer", children: [
|
|
708
|
+
"Didn't receive the email?",
|
|
709
|
+
" ",
|
|
710
|
+
/* @__PURE__ */ jsx(
|
|
711
|
+
"button",
|
|
712
|
+
{
|
|
713
|
+
onClick: () => {
|
|
714
|
+
void handleResend();
|
|
715
|
+
},
|
|
716
|
+
disabled: resendDisabled || isSending,
|
|
717
|
+
className: "if-verificationStep-resendButton",
|
|
718
|
+
children: isSending ? "Sending..." : resendDisabled ? `Retry in (${resendCountdown}s)` : "Click to resend"
|
|
719
|
+
}
|
|
720
|
+
)
|
|
721
|
+
] })
|
|
722
|
+
] });
|
|
723
|
+
}
|
|
724
|
+
function AuthResetPasswordVerificationStep({
|
|
725
|
+
email,
|
|
726
|
+
method,
|
|
727
|
+
onVerifyCode,
|
|
728
|
+
onResendEmail
|
|
729
|
+
}) {
|
|
730
|
+
const [resendDisabled, setResendDisabled] = useState(true);
|
|
731
|
+
const [resendCountdown, setResendCountdown] = useState(60);
|
|
732
|
+
const [isSending, setIsSending] = useState(false);
|
|
733
|
+
const [verificationCode, setVerificationCode] = useState("");
|
|
734
|
+
const [isVerifying, setIsVerifying] = useState(false);
|
|
735
|
+
useEffect(() => {
|
|
736
|
+
if (resendCountdown > 0) {
|
|
737
|
+
const timer = setInterval(() => {
|
|
738
|
+
setResendCountdown((prev) => {
|
|
739
|
+
if (prev <= 1) {
|
|
740
|
+
setResendDisabled(false);
|
|
741
|
+
return 0;
|
|
742
|
+
}
|
|
743
|
+
return prev - 1;
|
|
744
|
+
});
|
|
745
|
+
}, 1e3);
|
|
746
|
+
return () => clearInterval(timer);
|
|
747
|
+
}
|
|
748
|
+
}, [resendCountdown]);
|
|
749
|
+
const handleResend = useCallback(async () => {
|
|
750
|
+
setResendDisabled(true);
|
|
751
|
+
setResendCountdown(60);
|
|
752
|
+
setIsSending(true);
|
|
753
|
+
try {
|
|
754
|
+
await onResendEmail();
|
|
755
|
+
} catch {
|
|
756
|
+
setResendDisabled(false);
|
|
757
|
+
setResendCountdown(0);
|
|
758
|
+
} finally {
|
|
759
|
+
setIsSending(false);
|
|
760
|
+
}
|
|
761
|
+
}, [onResendEmail]);
|
|
762
|
+
const handleSubmit = async () => {
|
|
763
|
+
if (!onVerifyCode || verificationCode.length !== 6) {
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
setIsVerifying(true);
|
|
767
|
+
try {
|
|
768
|
+
await onVerifyCode(verificationCode);
|
|
769
|
+
} finally {
|
|
770
|
+
setIsVerifying(false);
|
|
771
|
+
setVerificationCode("");
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
const isLinkMethod = method === "link";
|
|
775
|
+
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.`;
|
|
776
|
+
return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
|
|
777
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: description }),
|
|
778
|
+
!isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
|
|
779
|
+
/* @__PURE__ */ jsx("div", { className: "if-verificationStep-codeInputWrapper", children: /* @__PURE__ */ jsx(
|
|
780
|
+
AuthVerificationCodeInput,
|
|
781
|
+
{
|
|
782
|
+
value: verificationCode,
|
|
783
|
+
onChange: setVerificationCode,
|
|
784
|
+
email,
|
|
785
|
+
disabled: isVerifying
|
|
786
|
+
}
|
|
787
|
+
) }),
|
|
788
|
+
/* @__PURE__ */ jsx(
|
|
789
|
+
AuthSubmitButton,
|
|
790
|
+
{
|
|
791
|
+
type: "button",
|
|
792
|
+
isLoading: isVerifying,
|
|
793
|
+
disabled: isVerifying || verificationCode.length !== 6,
|
|
794
|
+
onClick: () => {
|
|
795
|
+
void handleSubmit();
|
|
796
|
+
},
|
|
797
|
+
children: isVerifying ? "Verifying..." : "Continue"
|
|
798
|
+
}
|
|
799
|
+
)
|
|
800
|
+
] }),
|
|
801
|
+
/* @__PURE__ */ jsxs("div", { className: "if-verificationStep-resendContainer", children: [
|
|
802
|
+
"Didn't receive the email?",
|
|
803
|
+
" ",
|
|
804
|
+
/* @__PURE__ */ jsx(
|
|
805
|
+
"button",
|
|
806
|
+
{
|
|
807
|
+
onClick: () => {
|
|
808
|
+
void handleResend();
|
|
809
|
+
},
|
|
810
|
+
disabled: resendDisabled || isSending,
|
|
811
|
+
className: "if-verificationStep-resendButton",
|
|
812
|
+
children: isSending ? "Sending..." : resendDisabled ? `Retry in (${resendCountdown}s)` : "Click to resend"
|
|
813
|
+
}
|
|
814
|
+
)
|
|
815
|
+
] })
|
|
798
816
|
] });
|
|
799
817
|
}
|
|
800
818
|
function SignInForm({
|
|
@@ -824,8 +842,7 @@ function SignInForm({
|
|
|
824
842
|
signUpUrl = "/sign-up",
|
|
825
843
|
dividerText = "or",
|
|
826
844
|
showVerificationStep = false,
|
|
827
|
-
onVerifyCode
|
|
828
|
-
verificationDescription
|
|
845
|
+
onVerifyCode
|
|
829
846
|
}) {
|
|
830
847
|
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
831
848
|
/* @__PURE__ */ jsx(
|
|
@@ -836,14 +853,7 @@ function SignInForm({
|
|
|
836
853
|
}
|
|
837
854
|
),
|
|
838
855
|
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
839
|
-
showVerificationStep ? /* @__PURE__ */ jsx(
|
|
840
|
-
AuthEmailVerificationStep,
|
|
841
|
-
{
|
|
842
|
-
email,
|
|
843
|
-
description: verificationDescription,
|
|
844
|
-
onVerifyCode
|
|
845
|
-
}
|
|
846
|
-
) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
856
|
+
showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
847
857
|
/* @__PURE__ */ jsx(
|
|
848
858
|
AuthFormField,
|
|
849
859
|
{
|
|
@@ -918,8 +928,7 @@ function SignUpForm({
|
|
|
918
928
|
signInUrl = "/sign-in",
|
|
919
929
|
dividerText = "or",
|
|
920
930
|
showVerificationStep = false,
|
|
921
|
-
onVerifyCode
|
|
922
|
-
verificationDescription
|
|
931
|
+
onVerifyCode
|
|
923
932
|
}) {
|
|
924
933
|
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
925
934
|
/* @__PURE__ */ jsx(
|
|
@@ -930,14 +939,7 @@ function SignUpForm({
|
|
|
930
939
|
}
|
|
931
940
|
),
|
|
932
941
|
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
933
|
-
showVerificationStep ? /* @__PURE__ */ jsx(
|
|
934
|
-
AuthEmailVerificationStep,
|
|
935
|
-
{
|
|
936
|
-
email,
|
|
937
|
-
description: verificationDescription,
|
|
938
|
-
onVerifyCode
|
|
939
|
-
}
|
|
940
|
-
) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
942
|
+
showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
941
943
|
/* @__PURE__ */ jsx(
|
|
942
944
|
AuthFormField,
|
|
943
945
|
{
|
|
@@ -991,7 +993,6 @@ function ForgotPasswordForm({
|
|
|
991
993
|
onSubmit,
|
|
992
994
|
error,
|
|
993
995
|
loading = false,
|
|
994
|
-
success = false,
|
|
995
996
|
title = "Forgot Password?",
|
|
996
997
|
subtitle = "Enter your email address and we'll send you a code to reset your password.",
|
|
997
998
|
emailLabel = "Email",
|
|
@@ -1000,53 +1001,30 @@ function ForgotPasswordForm({
|
|
|
1000
1001
|
loadingButtonText = "Sending...",
|
|
1001
1002
|
backToSignInText = "Remember your password?",
|
|
1002
1003
|
backToSignInUrl = "/sign-in",
|
|
1003
|
-
|
|
1004
|
-
|
|
1004
|
+
showVerificationStep = false,
|
|
1005
|
+
resetPasswordMethod = "code",
|
|
1006
|
+
onVerifyCode,
|
|
1007
|
+
onResendEmail
|
|
1005
1008
|
}) {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
+
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
1010
|
+
/* @__PURE__ */ jsx(
|
|
1011
|
+
AuthHeader,
|
|
1009
1012
|
{
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
/* @__PURE__ */ jsx(
|
|
1013
|
-
"div",
|
|
1014
|
-
{
|
|
1015
|
-
style: {
|
|
1016
|
-
width: "4rem",
|
|
1017
|
-
height: "4rem",
|
|
1018
|
-
borderRadius: "50%",
|
|
1019
|
-
backgroundColor: "#D1FAE5",
|
|
1020
|
-
display: "flex",
|
|
1021
|
-
alignItems: "center",
|
|
1022
|
-
justifyContent: "center"
|
|
1023
|
-
},
|
|
1024
|
-
children: /* @__PURE__ */ jsx(
|
|
1025
|
-
"svg",
|
|
1026
|
-
{
|
|
1027
|
-
style: { width: "2rem", height: "2rem", color: "#059669" },
|
|
1028
|
-
fill: "none",
|
|
1029
|
-
strokeLinecap: "round",
|
|
1030
|
-
strokeLinejoin: "round",
|
|
1031
|
-
strokeWidth: "2",
|
|
1032
|
-
viewBox: "0 0 24 24",
|
|
1033
|
-
stroke: "currentColor",
|
|
1034
|
-
children: /* @__PURE__ */ jsx("path", { d: "M5 13l4 4L19 7" })
|
|
1035
|
-
}
|
|
1036
|
-
)
|
|
1037
|
-
}
|
|
1038
|
-
),
|
|
1039
|
-
/* @__PURE__ */ jsx("h2", { className: "if-authHeader-title", style: { textAlign: "center" }, children: successTitle }),
|
|
1040
|
-
/* @__PURE__ */ jsx("p", { className: "if-authHeader-subtitle", style: { textAlign: "center" }, children: successMessage || `We've sent a password reset link to ${email}. Please check your email and follow the instructions.` }),
|
|
1041
|
-
/* @__PURE__ */ jsx("a", { href: backToSignInUrl, className: "if-authLink-link", style: { marginTop: "1rem" }, children: "Back to Sign In" })
|
|
1042
|
-
]
|
|
1013
|
+
title: showVerificationStep ? resetPasswordMethod === "link" ? "Check Your Email" : "Enter Reset Code" : title,
|
|
1014
|
+
subtitle: showVerificationStep ? "" : subtitle
|
|
1043
1015
|
}
|
|
1044
|
-
)
|
|
1045
|
-
}
|
|
1046
|
-
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
1047
|
-
/* @__PURE__ */ jsx(AuthHeader, { title, subtitle }),
|
|
1016
|
+
),
|
|
1048
1017
|
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
1049
|
-
/* @__PURE__ */
|
|
1018
|
+
showVerificationStep ? /* @__PURE__ */ jsx(
|
|
1019
|
+
AuthResetPasswordVerificationStep,
|
|
1020
|
+
{
|
|
1021
|
+
email,
|
|
1022
|
+
method: resetPasswordMethod,
|
|
1023
|
+
onVerifyCode,
|
|
1024
|
+
onResendEmail: onResendEmail || (async () => {
|
|
1025
|
+
})
|
|
1026
|
+
}
|
|
1027
|
+
) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
1050
1028
|
/* @__PURE__ */ jsx(
|
|
1051
1029
|
AuthFormField,
|
|
1052
1030
|
{
|
|
@@ -1062,7 +1040,7 @@ function ForgotPasswordForm({
|
|
|
1062
1040
|
),
|
|
1063
1041
|
/* @__PURE__ */ jsx(AuthSubmitButton, { isLoading: loading, disabled: loading, children: loading ? loadingButtonText : submitButtonText })
|
|
1064
1042
|
] }),
|
|
1065
|
-
/* @__PURE__ */ jsx(AuthLink, { text: backToSignInText, linkText: "Back to Sign In", href: backToSignInUrl })
|
|
1043
|
+
!showVerificationStep && /* @__PURE__ */ jsx(AuthLink, { text: backToSignInText, linkText: "Back to Sign In", href: backToSignInUrl })
|
|
1066
1044
|
] });
|
|
1067
1045
|
}
|
|
1068
1046
|
function ResetPasswordForm({
|
|
@@ -1083,11 +1061,12 @@ function ResetPasswordForm({
|
|
|
1083
1061
|
confirmPasswordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
1084
1062
|
submitButtonText = "Reset Password",
|
|
1085
1063
|
loadingButtonText = "Resetting...",
|
|
1086
|
-
|
|
1087
|
-
backToSignInUrl = "/sign-in",
|
|
1088
|
-
successTitle = "Password Reset Successful!",
|
|
1089
|
-
successMessage = "Your password has been successfully reset. You can now sign in with your new password."
|
|
1064
|
+
successTitle = "Password Reset Successful!"
|
|
1090
1065
|
}) {
|
|
1066
|
+
let successMessage = "Your password has been successfully reset. You can close this page and sign in with your new password.";
|
|
1067
|
+
if (authConfig && authConfig.verifyEmailMethod === "code") {
|
|
1068
|
+
successMessage = "Your password has been successfully reset. You can wait for redirect to sign in with your new password.";
|
|
1069
|
+
}
|
|
1091
1070
|
if (success) {
|
|
1092
1071
|
return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsxs(
|
|
1093
1072
|
"div",
|
|
@@ -1122,8 +1101,7 @@ function ResetPasswordForm({
|
|
|
1122
1101
|
}
|
|
1123
1102
|
),
|
|
1124
1103
|
/* @__PURE__ */ jsx("h2", { className: "if-authHeader-title", style: { textAlign: "center" }, children: successTitle }),
|
|
1125
|
-
/* @__PURE__ */ jsx("p", { className: "if-authHeader-subtitle", style: { textAlign: "center" }, children: successMessage })
|
|
1126
|
-
/* @__PURE__ */ jsx("a", { href: backToSignInUrl, className: "if-authLink-link", style: { marginTop: "1rem" }, children: "Back to Sign In" })
|
|
1104
|
+
/* @__PURE__ */ jsx("p", { className: "if-authHeader-subtitle", style: { textAlign: "center" }, children: successMessage })
|
|
1127
1105
|
]
|
|
1128
1106
|
}
|
|
1129
1107
|
) });
|
|
@@ -1160,8 +1138,7 @@ function ResetPasswordForm({
|
|
|
1160
1138
|
}
|
|
1161
1139
|
),
|
|
1162
1140
|
/* @__PURE__ */ jsx(AuthSubmitButton, { isLoading: loading, disabled: loading, children: loading ? loadingButtonText : submitButtonText })
|
|
1163
|
-
] })
|
|
1164
|
-
/* @__PURE__ */ jsx(AuthLink, { text: backToSignInText, linkText: "Back to Sign In", href: backToSignInUrl })
|
|
1141
|
+
] })
|
|
1165
1142
|
] });
|
|
1166
1143
|
}
|
|
1167
1144
|
function VerifyEmailStatus({
|
|
@@ -1169,111 +1146,41 @@ function VerifyEmailStatus({
|
|
|
1169
1146
|
error,
|
|
1170
1147
|
verifyingTitle = "Verifying your email...",
|
|
1171
1148
|
successTitle = "Email Verified!",
|
|
1172
|
-
successMessage = "Your email has been verified successfully. You can close this page and
|
|
1149
|
+
successMessage = "Your email has been verified successfully. You can close this page and sign in to your app.",
|
|
1173
1150
|
errorTitle = "Verification Failed"
|
|
1174
1151
|
}) {
|
|
1175
1152
|
if (status === "verifying") {
|
|
1176
|
-
return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsxs(
|
|
1177
|
-
"
|
|
1178
|
-
{
|
|
1179
|
-
|
|
1180
|
-
width: "100%",
|
|
1181
|
-
display: "flex",
|
|
1182
|
-
flexDirection: "column",
|
|
1183
|
-
alignItems: "center",
|
|
1184
|
-
justifyContent: "center",
|
|
1185
|
-
gap: "1.5rem"
|
|
1186
|
-
},
|
|
1187
|
-
children: [
|
|
1188
|
-
/* @__PURE__ */ jsx("h2", { className: "if-authHeader-title", children: verifyingTitle }),
|
|
1189
|
-
/* @__PURE__ */ jsx(
|
|
1190
|
-
"div",
|
|
1191
|
-
{
|
|
1192
|
-
className: "if-submitButton-spinner",
|
|
1193
|
-
style: {
|
|
1194
|
-
borderRadius: "50%",
|
|
1195
|
-
height: "3rem",
|
|
1196
|
-
width: "3rem",
|
|
1197
|
-
borderBottom: "2px solid black"
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
)
|
|
1201
|
-
]
|
|
1202
|
-
}
|
|
1203
|
-
) });
|
|
1153
|
+
return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsxs("div", { className: "if-verifyStatus-container", children: [
|
|
1154
|
+
/* @__PURE__ */ jsx("h2", { className: "if-authHeader-title", children: verifyingTitle }),
|
|
1155
|
+
/* @__PURE__ */ jsx("div", { className: "if-submitButton-spinner if-verifyStatus-spinner" })
|
|
1156
|
+
] }) });
|
|
1204
1157
|
}
|
|
1205
1158
|
if (status === "error") {
|
|
1206
|
-
return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsx(
|
|
1207
|
-
"
|
|
1159
|
+
return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsx("div", { className: "if-verifyStatus-container-stretch", children: /* @__PURE__ */ jsxs("div", { className: "if-authHeader if-internal-h3m7w5", children: [
|
|
1160
|
+
/* @__PURE__ */ jsx("h1", { className: "if-authHeader-title if-internal-t4p1k9", children: errorTitle }),
|
|
1161
|
+
/* @__PURE__ */ jsxs("p", { className: "if-authHeader-subtitle if-internal-s7q2m3", children: [
|
|
1162
|
+
error || "The verification link is invalid or has expired.",
|
|
1163
|
+
" Please try again or contact support if the problem persists. You can close this page and return to your app."
|
|
1164
|
+
] })
|
|
1165
|
+
] }) }) });
|
|
1166
|
+
}
|
|
1167
|
+
return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsx("div", { className: "if-verifyStatus-container-stretch", children: /* @__PURE__ */ jsxs("div", { className: "if-verifyStatus-successContent", children: [
|
|
1168
|
+
/* @__PURE__ */ jsx("div", { className: "if-verifyStatus-successIcon", children: /* @__PURE__ */ jsx(
|
|
1169
|
+
"svg",
|
|
1208
1170
|
{
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
}
|
|
1217
|
-
children: /* @__PURE__ */ jsxs("div", { className: "if-authHeader if-internal-h3m7w5", children: [
|
|
1218
|
-
/* @__PURE__ */ jsx("h1", { className: "if-authHeader-title if-internal-t4p1k9", children: errorTitle }),
|
|
1219
|
-
/* @__PURE__ */ jsxs("p", { className: "if-authHeader-subtitle if-internal-s7q2m3", style: { lineHeight: "1.5" }, children: [
|
|
1220
|
-
error || "The verification link is invalid or has expired.",
|
|
1221
|
-
" Please try again or contact support if the problem persists. You can close this page and return to your app."
|
|
1222
|
-
] })
|
|
1223
|
-
] })
|
|
1171
|
+
className: "if-verifyStatus-successIconSvg",
|
|
1172
|
+
fill: "none",
|
|
1173
|
+
strokeLinecap: "round",
|
|
1174
|
+
strokeLinejoin: "round",
|
|
1175
|
+
strokeWidth: "2",
|
|
1176
|
+
viewBox: "0 0 24 24",
|
|
1177
|
+
stroke: "currentColor",
|
|
1178
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5 13l4 4L19 7" })
|
|
1224
1179
|
}
|
|
1225
|
-
) })
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
{
|
|
1230
|
-
style: {
|
|
1231
|
-
width: "100%",
|
|
1232
|
-
display: "flex",
|
|
1233
|
-
flexDirection: "column",
|
|
1234
|
-
alignItems: "stretch",
|
|
1235
|
-
justifyContent: "center",
|
|
1236
|
-
gap: "1.5rem"
|
|
1237
|
-
},
|
|
1238
|
-
children: /* @__PURE__ */ jsxs(
|
|
1239
|
-
"div",
|
|
1240
|
-
{
|
|
1241
|
-
style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "1rem" },
|
|
1242
|
-
children: [
|
|
1243
|
-
/* @__PURE__ */ jsx(
|
|
1244
|
-
"div",
|
|
1245
|
-
{
|
|
1246
|
-
style: {
|
|
1247
|
-
width: "4rem",
|
|
1248
|
-
height: "4rem",
|
|
1249
|
-
borderRadius: "50%",
|
|
1250
|
-
backgroundColor: "#D1FAE5",
|
|
1251
|
-
display: "flex",
|
|
1252
|
-
alignItems: "center",
|
|
1253
|
-
justifyContent: "center"
|
|
1254
|
-
},
|
|
1255
|
-
children: /* @__PURE__ */ jsx(
|
|
1256
|
-
"svg",
|
|
1257
|
-
{
|
|
1258
|
-
style: { width: "2rem", height: "2rem", color: "#059669" },
|
|
1259
|
-
fill: "none",
|
|
1260
|
-
strokeLinecap: "round",
|
|
1261
|
-
strokeLinejoin: "round",
|
|
1262
|
-
strokeWidth: "2",
|
|
1263
|
-
viewBox: "0 0 24 24",
|
|
1264
|
-
stroke: "currentColor",
|
|
1265
|
-
children: /* @__PURE__ */ jsx("path", { d: "M5 13l4 4L19 7" })
|
|
1266
|
-
}
|
|
1267
|
-
)
|
|
1268
|
-
}
|
|
1269
|
-
),
|
|
1270
|
-
/* @__PURE__ */ jsx("h2", { className: "if-authHeader-title", style: { textAlign: "center" }, children: successTitle }),
|
|
1271
|
-
/* @__PURE__ */ jsx("p", { className: "if-authHeader-subtitle", style: { textAlign: "center" }, children: successMessage })
|
|
1272
|
-
]
|
|
1273
|
-
}
|
|
1274
|
-
)
|
|
1275
|
-
}
|
|
1276
|
-
) });
|
|
1180
|
+
) }),
|
|
1181
|
+
/* @__PURE__ */ jsx("h2", { className: "if-authHeader-title if-verifyStatus-textCenter", children: successTitle }),
|
|
1182
|
+
/* @__PURE__ */ jsx("p", { className: "if-authHeader-subtitle if-verifyStatus-textCenter", children: successMessage })
|
|
1183
|
+
] }) }) });
|
|
1277
1184
|
}
|
|
1278
1185
|
|
|
1279
1186
|
export { ForgotPasswordForm, ResetPasswordForm, SignInForm, SignUpForm, VerifyEmailStatus };
|