@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.
@@ -571,7 +571,6 @@ function AuthOAuthProviders({
571
571
  function AuthVerificationCodeInput({
572
572
  length = 6,
573
573
  value,
574
- email,
575
574
  onChange,
576
575
  disabled = false,
577
576
  onComplete
@@ -619,33 +618,25 @@ function AuthVerificationCodeInput({
619
618
  }
620
619
  }
621
620
  };
622
- return /* @__PURE__ */ jsxs("div", { className: "if-verificationCode if-internal-vc8m4p", children: [
623
- /* @__PURE__ */ jsxs("p", { className: "if-verificationCode-description", children: [
624
- "We've sent a verification code to your inbox at",
625
- " ",
626
- /* @__PURE__ */ jsx("span", { className: "if-verificationCode-email", children: email }),
627
- ". Enter it below to proceed."
628
- ] }),
629
- /* @__PURE__ */ jsx("div", { className: "if-verificationCode-inputContainer", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsx(
630
- "input",
631
- {
632
- ref: (el) => {
633
- inputRefs.current[index] = el;
634
- },
635
- type: "text",
636
- inputMode: "numeric",
637
- maxLength: 1,
638
- value: value[index] || "",
639
- onChange: (e) => handleChange(index, e.target.value),
640
- onKeyDown: (e) => handleKeyDown(index, e),
641
- onPaste: handlePaste,
642
- disabled,
643
- className: "if-verificationCode-input",
644
- autoComplete: "one-time-code"
621
+ return /* @__PURE__ */ jsx("div", { className: "if-verificationCode-inputContainer", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsx(
622
+ "input",
623
+ {
624
+ ref: (el) => {
625
+ inputRefs.current[index] = el;
645
626
  },
646
- index
647
- )) })
648
- ] });
627
+ type: "text",
628
+ inputMode: "numeric",
629
+ maxLength: 1,
630
+ value: value[index] || "",
631
+ onChange: (e) => handleChange(index, e.target.value),
632
+ onKeyDown: (e) => handleKeyDown(index, e),
633
+ onPaste: handlePaste,
634
+ disabled,
635
+ className: "if-verificationCode-input",
636
+ autoComplete: "one-time-code"
637
+ },
638
+ index
639
+ )) });
649
640
  }
650
641
  function AuthEmailVerificationStep({
651
642
  email,
@@ -658,7 +649,8 @@ function AuthEmailVerificationStep({
658
649
  const [isSending, setIsSending] = useState(false);
659
650
  const [verificationCode, setVerificationCode] = useState("");
660
651
  const [isVerifying, setIsVerifying] = useState(false);
661
- 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.";
652
+ const isLinkMethod = method === "link";
653
+ 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.";
662
654
  useEffect(() => {
663
655
  const sendInitialEmail = async () => {
664
656
  try {
@@ -708,23 +700,29 @@ function AuthEmailVerificationStep({
708
700
  setVerificationCode("");
709
701
  }
710
702
  };
711
- const displayDescription = defaultDescription;
712
- const isLinkMethod = method === "link";
713
703
  return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
714
- /* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
715
- part,
716
- index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationCode-email", children: email })
717
- ] }, index)) }),
704
+ isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-descriptionContainer", children: [
705
+ /* @__PURE__ */ jsx("p", { className: "if-verificationStep-descriptionTitle", children: "Verify Your Email" }),
706
+ /* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
707
+ part,
708
+ index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationLink-email", children: email })
709
+ ] }, index)) })
710
+ ] }),
718
711
  !isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
719
- /* @__PURE__ */ jsx("div", { className: "if-verificationStep-codeInputWrapper", children: /* @__PURE__ */ jsx(
720
- AuthVerificationCodeInput,
721
- {
722
- value: verificationCode,
723
- onChange: setVerificationCode,
724
- email,
725
- disabled: isVerifying
726
- }
727
- ) }),
712
+ /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeInputWrapper", children: [
713
+ /* @__PURE__ */ jsx("p", { className: "if-verificationStep-codeDescription", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
714
+ part,
715
+ index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationCode-email", children: email })
716
+ ] }, index)) }),
717
+ /* @__PURE__ */ jsx(
718
+ AuthVerificationCodeInput,
719
+ {
720
+ value: verificationCode,
721
+ onChange: setVerificationCode,
722
+ disabled: isVerifying
723
+ }
724
+ )
725
+ ] }),
728
726
  /* @__PURE__ */ jsx(
729
727
  AuthSubmitButton,
730
728
  {
@@ -734,7 +732,7 @@ function AuthEmailVerificationStep({
734
732
  onClick: () => {
735
733
  void handleSubmit();
736
734
  },
737
- children: isVerifying ? "Verifying..." : "Verify Code"
735
+ children: isVerifying ? "Verifying..." : "Continue"
738
736
  }
739
737
  )
740
738
  ] }),
@@ -766,6 +764,8 @@ function AuthResetPasswordVerificationStep({
766
764
  const [isSending, setIsSending] = useState(false);
767
765
  const [verificationCode, setVerificationCode] = useState("");
768
766
  const [isVerifying, setIsVerifying] = useState(false);
767
+ const isLinkMethod = method === "link";
768
+ 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.";
769
769
  useEffect(() => {
770
770
  if (resendCountdown > 0) {
771
771
  const timer = setInterval(() => {
@@ -805,17 +805,20 @@ function AuthResetPasswordVerificationStep({
805
805
  setVerificationCode("");
806
806
  }
807
807
  };
808
- const isLinkMethod = method === "link";
809
- 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.`;
810
808
  return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
811
- /* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: description }),
809
+ isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-descriptionContainer", children: [
810
+ /* @__PURE__ */ jsx("p", { className: "if-verificationStep-descriptionTitle", children: "Check Your Email" }),
811
+ /* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
812
+ part,
813
+ index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationLink-email", children: email })
814
+ ] }, index)) })
815
+ ] }),
812
816
  !isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
813
817
  /* @__PURE__ */ jsx("div", { className: "if-verificationStep-codeInputWrapper", children: /* @__PURE__ */ jsx(
814
818
  AuthVerificationCodeInput,
815
819
  {
816
820
  value: verificationCode,
817
821
  onChange: setVerificationCode,
818
- email,
819
822
  disabled: isVerifying
820
823
  }
821
824
  ) }),
@@ -868,7 +871,7 @@ function SignInForm({
868
871
  passwordLabel = "Password",
869
872
  passwordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
870
873
  forgotPasswordText = "Forget Password?",
871
- forgotPasswordUrl,
874
+ forgotPasswordUrl = "/forgot-password",
872
875
  submitButtonText = "Sign In",
873
876
  loadingButtonText = "Signing in...",
874
877
  signUpText = "Don't have an account?",
@@ -879,13 +882,7 @@ function SignInForm({
879
882
  onVerifyCode
880
883
  }) {
881
884
  return /* @__PURE__ */ jsxs(AuthContainer, { children: [
882
- /* @__PURE__ */ jsx(
883
- AuthHeader,
884
- {
885
- title: showVerificationStep ? "Verify Your Email" : title,
886
- subtitle: showVerificationStep ? "" : subtitle
887
- }
888
- ),
885
+ /* @__PURE__ */ jsx(AuthHeader, { title, subtitle }),
889
886
  /* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
890
887
  showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
891
888
  /* @__PURE__ */ jsx(
@@ -984,7 +981,7 @@ function SignIn({ onError, ...uiProps }) {
984
981
  async function handleVerifyCode(code) {
985
982
  setError("");
986
983
  try {
987
- const result = await verifyEmail(email, code);
984
+ const result = await verifyEmail(code, email);
988
985
  if (result?.error) {
989
986
  throw new Error(result.error.message || "Verification failed");
990
987
  }
@@ -1055,13 +1052,7 @@ function SignUpForm({
1055
1052
  onVerifyCode
1056
1053
  }) {
1057
1054
  return /* @__PURE__ */ jsxs(AuthContainer, { children: [
1058
- /* @__PURE__ */ jsx(
1059
- AuthHeader,
1060
- {
1061
- title: showVerificationStep ? "Verify Your Email" : title,
1062
- subtitle: showVerificationStep ? "" : subtitle
1063
- }
1064
- ),
1055
+ /* @__PURE__ */ jsx(AuthHeader, { title, subtitle }),
1065
1056
  /* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
1066
1057
  showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
1067
1058
  /* @__PURE__ */ jsx(
@@ -1211,7 +1202,7 @@ function SignUp({ onError, ...uiProps }) {
1211
1202
  async function handleVerifyCode(code) {
1212
1203
  setError("");
1213
1204
  try {
1214
- const result = await verifyEmail(email, code);
1205
+ const result = await verifyEmail(code, email);
1215
1206
  if (result?.error) {
1216
1207
  throw new Error(result.error.message || "Verification failed");
1217
1208
  }
@@ -1261,10 +1252,10 @@ function ForgotPasswordForm({
1261
1252
  error,
1262
1253
  loading = false,
1263
1254
  title = "Forgot Password?",
1264
- subtitle = "Enter your email address and we'll send you a code to reset your password.",
1255
+ subtitle = "Enter your email address and we'll send you a {method} to reset your password.",
1265
1256
  emailLabel = "Email",
1266
1257
  emailPlaceholder = "example@email.com",
1267
- submitButtonText = "Send Reset Code",
1258
+ submitButtonText = "Reset Password",
1268
1259
  loadingButtonText = "Sending...",
1269
1260
  backToSignInText = "Remember your password?",
1270
1261
  backToSignInUrl = "/sign-in",
@@ -1273,14 +1264,9 @@ function ForgotPasswordForm({
1273
1264
  onVerifyCode,
1274
1265
  onResendEmail
1275
1266
  }) {
1267
+ const displaySubtitle = subtitle.replace("{method}", resetPasswordMethod);
1276
1268
  return /* @__PURE__ */ jsxs(AuthContainer, { children: [
1277
- /* @__PURE__ */ jsx(
1278
- AuthHeader,
1279
- {
1280
- title: showVerificationStep ? resetPasswordMethod === "link" ? "Check Your Email" : "Enter Reset Code" : title,
1281
- subtitle: showVerificationStep ? "" : subtitle
1282
- }
1283
- ),
1269
+ /* @__PURE__ */ jsx(AuthHeader, { title, subtitle: displaySubtitle }),
1284
1270
  /* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
1285
1271
  showVerificationStep ? /* @__PURE__ */ jsx(
1286
1272
  AuthResetPasswordVerificationStep,