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