@insforge/react 0.4.7 → 0.4.8
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/atoms.cjs +51 -48
- package/dist/atoms.cjs.map +1 -1
- package/dist/atoms.d.cts +1 -2
- package/dist/atoms.d.ts +1 -2
- package/dist/atoms.js +51 -48
- package/dist/atoms.js.map +1 -1
- package/dist/components.cjs +60 -74
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +60 -74
- package/dist/components.js.map +1 -1
- package/dist/forms.cjs +58 -72
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.js +58 -72
- package/dist/forms.js.map +1 -1
- package/dist/index.cjs +72 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -96
- 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 -63
- package/package.json +1 -1
package/dist/forms.js
CHANGED
|
@@ -543,7 +543,6 @@ function AuthOAuthProviders({
|
|
|
543
543
|
function AuthVerificationCodeInput({
|
|
544
544
|
length = 6,
|
|
545
545
|
value,
|
|
546
|
-
email,
|
|
547
546
|
onChange,
|
|
548
547
|
disabled = false,
|
|
549
548
|
onComplete
|
|
@@ -591,33 +590,25 @@ function AuthVerificationCodeInput({
|
|
|
591
590
|
}
|
|
592
591
|
}
|
|
593
592
|
};
|
|
594
|
-
return /* @__PURE__ */
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
". Enter it below to proceed."
|
|
600
|
-
] }),
|
|
601
|
-
/* @__PURE__ */ jsx("div", { className: "if-verificationCode-inputContainer", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsx(
|
|
602
|
-
"input",
|
|
603
|
-
{
|
|
604
|
-
ref: (el) => {
|
|
605
|
-
inputRefs.current[index] = el;
|
|
606
|
-
},
|
|
607
|
-
type: "text",
|
|
608
|
-
inputMode: "numeric",
|
|
609
|
-
maxLength: 1,
|
|
610
|
-
value: value[index] || "",
|
|
611
|
-
onChange: (e) => handleChange(index, e.target.value),
|
|
612
|
-
onKeyDown: (e) => handleKeyDown(index, e),
|
|
613
|
-
onPaste: handlePaste,
|
|
614
|
-
disabled,
|
|
615
|
-
className: "if-verificationCode-input",
|
|
616
|
-
autoComplete: "one-time-code"
|
|
593
|
+
return /* @__PURE__ */ jsx("div", { className: "if-verificationCode-inputContainer", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsx(
|
|
594
|
+
"input",
|
|
595
|
+
{
|
|
596
|
+
ref: (el) => {
|
|
597
|
+
inputRefs.current[index] = el;
|
|
617
598
|
},
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
599
|
+
type: "text",
|
|
600
|
+
inputMode: "numeric",
|
|
601
|
+
maxLength: 1,
|
|
602
|
+
value: value[index] || "",
|
|
603
|
+
onChange: (e) => handleChange(index, e.target.value),
|
|
604
|
+
onKeyDown: (e) => handleKeyDown(index, e),
|
|
605
|
+
onPaste: handlePaste,
|
|
606
|
+
disabled,
|
|
607
|
+
className: "if-verificationCode-input",
|
|
608
|
+
autoComplete: "one-time-code"
|
|
609
|
+
},
|
|
610
|
+
index
|
|
611
|
+
)) });
|
|
621
612
|
}
|
|
622
613
|
var InsforgeContext = createContext(void 0);
|
|
623
614
|
function useInsforge() {
|
|
@@ -638,7 +629,8 @@ function AuthEmailVerificationStep({
|
|
|
638
629
|
const [isSending, setIsSending] = useState(false);
|
|
639
630
|
const [verificationCode, setVerificationCode] = useState("");
|
|
640
631
|
const [isVerifying, setIsVerifying] = useState(false);
|
|
641
|
-
const
|
|
632
|
+
const isLinkMethod = method === "link";
|
|
633
|
+
const displayDescription = isLinkMethod ? "We have 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.";
|
|
642
634
|
useEffect(() => {
|
|
643
635
|
const sendInitialEmail = async () => {
|
|
644
636
|
try {
|
|
@@ -688,23 +680,29 @@ function AuthEmailVerificationStep({
|
|
|
688
680
|
setVerificationCode("");
|
|
689
681
|
}
|
|
690
682
|
};
|
|
691
|
-
const displayDescription = defaultDescription;
|
|
692
|
-
const isLinkMethod = method === "link";
|
|
693
683
|
return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
684
|
+
isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-descriptionContainer", children: [
|
|
685
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-descriptionTitle", children: "Verify Your Email" }),
|
|
686
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
|
|
687
|
+
part,
|
|
688
|
+
index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationLink-email", children: email })
|
|
689
|
+
] }, index)) })
|
|
690
|
+
] }),
|
|
698
691
|
!isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
|
|
699
|
-
/* @__PURE__ */
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
692
|
+
/* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeInputWrapper", children: [
|
|
693
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-codeDescription", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
|
|
694
|
+
part,
|
|
695
|
+
index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationCode-email", children: email })
|
|
696
|
+
] }, index)) }),
|
|
697
|
+
/* @__PURE__ */ jsx(
|
|
698
|
+
AuthVerificationCodeInput,
|
|
699
|
+
{
|
|
700
|
+
value: verificationCode,
|
|
701
|
+
onChange: setVerificationCode,
|
|
702
|
+
disabled: isVerifying
|
|
703
|
+
}
|
|
704
|
+
)
|
|
705
|
+
] }),
|
|
708
706
|
/* @__PURE__ */ jsx(
|
|
709
707
|
AuthSubmitButton,
|
|
710
708
|
{
|
|
@@ -714,7 +712,7 @@ function AuthEmailVerificationStep({
|
|
|
714
712
|
onClick: () => {
|
|
715
713
|
void handleSubmit();
|
|
716
714
|
},
|
|
717
|
-
children: isVerifying ? "Verifying..." : "
|
|
715
|
+
children: isVerifying ? "Verifying..." : "Continue"
|
|
718
716
|
}
|
|
719
717
|
)
|
|
720
718
|
] }),
|
|
@@ -746,6 +744,8 @@ function AuthResetPasswordVerificationStep({
|
|
|
746
744
|
const [isSending, setIsSending] = useState(false);
|
|
747
745
|
const [verificationCode, setVerificationCode] = useState("");
|
|
748
746
|
const [isVerifying, setIsVerifying] = useState(false);
|
|
747
|
+
const isLinkMethod = method === "link";
|
|
748
|
+
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.";
|
|
749
749
|
useEffect(() => {
|
|
750
750
|
if (resendCountdown > 0) {
|
|
751
751
|
const timer = setInterval(() => {
|
|
@@ -785,17 +785,20 @@ function AuthResetPasswordVerificationStep({
|
|
|
785
785
|
setVerificationCode("");
|
|
786
786
|
}
|
|
787
787
|
};
|
|
788
|
-
const isLinkMethod = method === "link";
|
|
789
|
-
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.`;
|
|
790
788
|
return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
|
|
791
|
-
/* @__PURE__ */
|
|
789
|
+
isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-descriptionContainer", children: [
|
|
790
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-descriptionTitle", children: "Check Your Email" }),
|
|
791
|
+
/* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
|
|
792
|
+
part,
|
|
793
|
+
index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationLink-email", children: email })
|
|
794
|
+
] }, index)) })
|
|
795
|
+
] }),
|
|
792
796
|
!isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
|
|
793
797
|
/* @__PURE__ */ jsx("div", { className: "if-verificationStep-codeInputWrapper", children: /* @__PURE__ */ jsx(
|
|
794
798
|
AuthVerificationCodeInput,
|
|
795
799
|
{
|
|
796
800
|
value: verificationCode,
|
|
797
801
|
onChange: setVerificationCode,
|
|
798
|
-
email,
|
|
799
802
|
disabled: isVerifying
|
|
800
803
|
}
|
|
801
804
|
) }),
|
|
@@ -848,7 +851,7 @@ function SignInForm({
|
|
|
848
851
|
passwordLabel = "Password",
|
|
849
852
|
passwordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
850
853
|
forgotPasswordText = "Forget Password?",
|
|
851
|
-
forgotPasswordUrl,
|
|
854
|
+
forgotPasswordUrl = "/forgot-password",
|
|
852
855
|
submitButtonText = "Sign In",
|
|
853
856
|
loadingButtonText = "Signing in...",
|
|
854
857
|
signUpText = "Don't have an account?",
|
|
@@ -859,13 +862,7 @@ function SignInForm({
|
|
|
859
862
|
onVerifyCode
|
|
860
863
|
}) {
|
|
861
864
|
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
862
|
-
/* @__PURE__ */ jsx(
|
|
863
|
-
AuthHeader,
|
|
864
|
-
{
|
|
865
|
-
title: showVerificationStep ? "Verify Your Email" : title,
|
|
866
|
-
subtitle: showVerificationStep ? "" : subtitle
|
|
867
|
-
}
|
|
868
|
-
),
|
|
865
|
+
/* @__PURE__ */ jsx(AuthHeader, { title, subtitle }),
|
|
869
866
|
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
870
867
|
showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
871
868
|
/* @__PURE__ */ jsx(
|
|
@@ -945,13 +942,7 @@ function SignUpForm({
|
|
|
945
942
|
onVerifyCode
|
|
946
943
|
}) {
|
|
947
944
|
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
948
|
-
/* @__PURE__ */ jsx(
|
|
949
|
-
AuthHeader,
|
|
950
|
-
{
|
|
951
|
-
title: showVerificationStep ? "Verify Your Email" : title,
|
|
952
|
-
subtitle: showVerificationStep ? "" : subtitle
|
|
953
|
-
}
|
|
954
|
-
),
|
|
945
|
+
/* @__PURE__ */ jsx(AuthHeader, { title, subtitle }),
|
|
955
946
|
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
956
947
|
showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
957
948
|
/* @__PURE__ */ jsx(
|
|
@@ -1008,10 +999,10 @@ function ForgotPasswordForm({
|
|
|
1008
999
|
error,
|
|
1009
1000
|
loading = false,
|
|
1010
1001
|
title = "Forgot Password?",
|
|
1011
|
-
subtitle = "Enter your email address and we'll send you a
|
|
1002
|
+
subtitle = "Enter your email address and we'll send you a {method} to reset your password.",
|
|
1012
1003
|
emailLabel = "Email",
|
|
1013
1004
|
emailPlaceholder = "example@email.com",
|
|
1014
|
-
submitButtonText = "
|
|
1005
|
+
submitButtonText = "Reset Password",
|
|
1015
1006
|
loadingButtonText = "Sending...",
|
|
1016
1007
|
backToSignInText = "Remember your password?",
|
|
1017
1008
|
backToSignInUrl = "/sign-in",
|
|
@@ -1020,14 +1011,9 @@ function ForgotPasswordForm({
|
|
|
1020
1011
|
onVerifyCode,
|
|
1021
1012
|
onResendEmail
|
|
1022
1013
|
}) {
|
|
1014
|
+
const displaySubtitle = subtitle.replace("{method}", resetPasswordMethod);
|
|
1023
1015
|
return /* @__PURE__ */ jsxs(AuthContainer, { children: [
|
|
1024
|
-
/* @__PURE__ */ jsx(
|
|
1025
|
-
AuthHeader,
|
|
1026
|
-
{
|
|
1027
|
-
title: showVerificationStep ? resetPasswordMethod === "link" ? "Check Your Email" : "Enter Reset Code" : title,
|
|
1028
|
-
subtitle: showVerificationStep ? "" : subtitle
|
|
1029
|
-
}
|
|
1030
|
-
),
|
|
1016
|
+
/* @__PURE__ */ jsx(AuthHeader, { title, subtitle: displaySubtitle }),
|
|
1031
1017
|
/* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
|
|
1032
1018
|
showVerificationStep ? /* @__PURE__ */ jsx(
|
|
1033
1019
|
AuthResetPasswordVerificationStep,
|